Skip to content

Instantly share code, notes, and snippets.

@chrisdone
chrisdone / output.txt
Created June 28, 2018 17:48
configure error
chris@precision:~/Work/ghc/base-4.11.1.0$ ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
chris@precision:~/Work/haskell/text$ stack ghci --with-ghc /home/chris/.local/bin/intero --ghci-options -fobject-code
text-1.2.3.0: initial-build-steps (lib)
The following GHC options are incompatible with GHCi and have not been passed to it: -O2
Configuring GHCi with the following packages: text
Intero 0.1.31 (GHC 8.2.2)
Type :intro and press enter for an introduction of the standard commands.
Intero-Service-Port: 39565
*** WARNING: /tmp/haskell-stack-ghci/5272f0aa is writable by someone else, IGNORING!
[ 1 of 44] Compiling Data.Text.Encoding.Error ( /home/chris/Work/haskell/text/Data/Text/Encoding/Error.hs, /home/chris/Work/haskell/text/.stack-work/odir/Data/Text/Encoding/Error.o )
@chrisdone
chrisdone / 0results.txt
Last active June 22, 2018 09:45
Lexer comparison
# demo.hell is repeated until the file is 100KB
benchmarking attoparsec
time 1.686 ms (1.679 ms .. 1.694 ms)
1.000 R² (0.999 R² .. 1.000 R²)
mean 1.678 ms (1.672 ms .. 1.686 ms)
std dev 25.18 μs (19.12 μs .. 32.91 μs)
benchmarking megaparsec
time 2.646 ms (2.627 ms .. 2.667 ms)
@chrisdone
chrisdone / basic-attoparsec-lexer.hs
Last active June 21, 2018 14:38
Attoparsec lexer
{-
on a 100KB file
benchmarking attoparsec
time 1.933 ms (1.895 ms .. 1.979 ms)
0.997 R² (0.995 R² .. 0.998 R²)
mean 1.929 ms (1.905 ms .. 1.962 ms)
std dev 92.75 μs (71.57 μs .. 120.6 μs)
variance introduced by outliers: 33% (moderately inflated)
-}
{-# LANGUAGE OverloadedStrings #-}
@chrisdone
chrisdone / Dockerfile
Last active June 1, 2018 14:36
debian:stretch-slim + stack
FROM debian:9-slim
MAINTAINER Chris Done
# Haskell system dependencies
RUN apt-get update && apt-get install -yq --no-install-suggests --no-install-recommends --force-yes -y netbase git ca-certificates xz-utils build-essential curl && curl -sSL https://get.haskellstack.org/ | sh
@chrisdone
chrisdone / repl.hs
Last active May 27, 2018 18:15
yamlet
> objectDoc stackObject
Ok, one module loaded.
Singleton
(fromList
[ ( Key "extra-deps"
, ( Just (Doc "empty list")
, Singleton
(ListDesc
(Doc "extra-deps")
@chrisdone
chrisdone / keybase.md
Created May 16, 2018 09:04
Keybase proof

Keybase proof

I hereby claim:

  • I am chrisdone on github.
  • I am chrisdone (https://keybase.io/chrisdone) on keybase.
  • I have a public key whose fingerprint is 9835 B294 BCC5 D487 5922 0A5B F106 28A4 B702 5382

To claim this, I am signing this object:

@chrisdone
chrisdone / idr.idr
Created May 9, 2018 14:40
Reading vector dynamically sized in Idris
-- Things that Idris doesn't have out of the box:
charToInt : Char -> Maybe Int
charToInt c = let i = cast {to=Int} c in
let zero = cast {to=Int} '0' in
let nine = cast {to=Int} '9' in
if i < zero || i > nine
then Nothing
else Just (i - zero)
@chrisdone
chrisdone / prof.txt
Created April 27, 2018 17:44
SDL prof
bash-3.2$ stack exec -- sdl-space +RTS -s
44,176 bytes allocated in the heap
3,384 bytes copied during GC
36,064 bytes maximum residency (1 sample(s))
13,088 bytes maximum slop
1 MB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 0 colls, 0 par 0.000s 0.000s 0.0000s 0.0000s
Gen 1 1 colls, 0 par 0.000s 0.004s 0.0038s 0.0038s
@chrisdone
chrisdone / diff.hs
Last active April 24, 2018 14:18
Difference between runState . runCatchT vs runCatch . runStateT
-- Changes to state on LHS of <|> (catch) is preserved
> runState (runCatchT ((put 1 >> throwM (ErrorCallWithLocation "" "a")) <|> get)) 0
(Right 1,1)
-- Changes to state on LHS of <|> (catch) is lost
> runCatch (runStateT ((put 1 >> throwM (ErrorCallWithLocation "" "a")) <|> get) 0)
Right (0,0)
-- ExcepT has the same behavior