This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- Unnecessarily knot tying solution to https://github.com/josevalim/nested-map-reduce-traversal | |
You can run it with: | |
$ ghc Main.hs && ./Main | |
Which outputs: | |
Numbered 0 ("One",[Numbered 0 "A",Numbered 1 "B"]) | |
Numbered 1 ("Two",[Numbered 2 "C",Numbered 3 "D",Numbered 4 "E"]) | |
Numbered 2 ("Three",[Numbered 0 "F",Numbered 1 "G"]) | |
Numbered 3 ("Four",[]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run with `node index.js` | |
function bubbleSort(list) { | |
for (let limit = 1; limit < list.length; limit++) { | |
for (let i = 0; i < list.length - limit; i++) { | |
let left = list[i]; | |
let right = list[i + 1]; | |
if (left > right) { | |
list[i] = right; | |
list[i+1] = left; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Wed Jul 3 12:04 2024 Time and Allocation Profiling Report (Final) | |
main +RTS -p -RTS test ghcup | |
total time = 56.65 secs (56648 ticks @ 1000 us, 1 processor) | |
total alloc = 338,254,238,432 bytes (excludes profiling overheads) | |
COST CENTRE MODULE SRC %time %alloc | |
serialize.write Main Main.hs:(99,3)-(107,53) 27.6 27.7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Database.MySQL | |
( Connected | |
, withConnection | |
, connected | |
) where | |
import Control.Concurrent (MVar, newMVar, newEmptyMVar, putMVar, takeMVar, tryPutMVar, modifyMVar_) | |
import Control.Concurrent.Async (withAsyncBound, withAsync, wait, waitEither) | |
import Control.Exception (SomeException, SomeAsyncException, fromException, bracket, throwIO, tryJust, tryJust) | |
import Control.Monad (unless, forever) |
OlderNewer