Skip to content

Instantly share code, notes, and snippets.

View haskell-weekly-in-2018.hs
#!/usr/bin/env stack
-- stack --resolver lts-13.0 script
{-# OPTIONS_GHC -Weverything -Wno-implicit-prelude -Wno-unsafe #-}
module Main ( main ) where
import qualified Data.Aeson
import qualified Data.Aeson.Types
import qualified Data.List
import qualified Data.Ord
tfausak / buoy.hs
Created Jan 3, 2019
keywords: Haskell applicative lift liftA liftA2 liftAN ap hoist raise boost
View buoy.hs
-- This whole thing is shamelessly stolen from:
-- <>.
-- Without flexible instances, GHC complains about the `HasApply` instances:
-- > Illegal instance declaration for `HasApply a Z`. All instance types must
-- > be of the form `(T a1 ... an)` where `a1 ... an` are *distinct type
-- > variables*, and each type variable appears at most once in the instance
-- > head.
tfausak / ratel-happstack.hs
Created Dec 7, 2018
Sends Happstack exceptions to Honeybadger.
View ratel-happstack.hs
#!/usr/bin/env stack
-- stack --resolver lts-12.10 script
{-# OPTIONS_GHC -Weverything -Wno-unsafe -Wno-implicit-prelude #-}
module Main ( main ) where
import qualified Control.Concurrent as Concurrent
import qualified Control.Monad as Monad
import qualified Control.Monad.Catch as Catch
import qualified Control.Monad.IO.Class as IO
import qualified Data.Map as Map
import qualified Data.Maybe as Maybe
tfausak / Main.hs
Last active Nov 18, 2018
Analyzes 2018 state of Haskell survey responses.
View Main.hs
#!/usr/bin/env stack
-- stack --resolver lts-10.0 script
module Main
( main
import qualified Control.Monad as Monad
import qualified Data.ByteString as ByteString
View rocket-league-replay-match-types.txt
replays/0ad2.replay Offline
replays/000b.replay Private
replays/1a12.replay Offline
replays/1ae4.replay Offline
replays/1bc2.replay Offline
replays/1d1d.replay Offline
replays/1ef9.replay Private
replays/1f37.replay Offline
replays/2cfe.replay Online
replays/3abd.replay LAN
tfausak / edit-replay.hs
Last active Jul 8, 2018
Changes every car in a Rocket League replay to be Octane with the striped decal. Uses Rattletrap:
View edit-replay.hs
#!/usr/bin/env stack
-- stack --resolver nightly-2018-06-01 script --compile
-- To run this, first install Stack: <>.
-- Then run this from the command line: `stack edit-replay.hs input.replay output.replay`
module Main ( main ) where
import qualified Data.ByteString.Lazy as L
import qualified Data.Map as M
tfausak / packages.json
Last active Jan 23, 2018
SLURP packages from Hackage as of 2018-01-23.
View packages.json
"packages": [
"location": "",
"name": "3d-graphics-examples"
"location": "",
"name": "3dmodels"
tfausak / _README.markdown
Last active Jan 17, 2018
Benchmark of various containers doing bit-level manipulation.
View _README.markdown

I'm back with more bit-level benchmarks in Haskell. The goal here is to do some work on each bit in a large string of bytes. The time to beat is about 5 ms, which is how long Rust takes to do this. Unfortunately it looks like Haskell isn't quite up to the task:

Type Time
ByteString 483.8 ms
Vector Bool (boxed) 315.9 ms
Vector Word8 (boxed) 500.3 ms
View rattletrap-4.0.1-performance.txt
0008: Decoded 0.090 MB in 156.435 ms at 0.575 MB/s
000b: Decoded 0.356 MB in 411.709 ms at 0.864 MB/s
07e9: Decoded 0.029 MB in 20.839 ms at 1.376 MB/s
0ad2: Decoded 0.027 MB in 17.437 ms at 1.529 MB/s
1205: Decoded 0.440 MB in 624.863 ms at 0.704 MB/s
160c: Decoded 0.539 MB in 685.560 ms at 0.786 MB/s
16d5: Decoded 0.029 MB in 20.244 ms at 1.446 MB/s
18d6: Decoded 0.021 MB in 14.670 ms at 1.430 MB/s
1a12: Decoded 0.094 MB in 77.999 ms at 1.208 MB/s
1ae4: Decoded 0.025 MB in 17.057 ms at 1.450 MB/s
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.