Skip to content

Instantly share code, notes, and snippets.

View twanvl's full-sized avatar

Twan van Laarhoven twanvl

View GitHub Profile
data Spine a
= NS (NS a a (a,a,a))
| AS (AS a a a)
deriving (Show)
-- non-adjacent spine: list of increasing size trees, with no two trees of adjacent index
data NS a b c
= Nil
| NMore (NS a c (a,b,c))
| NCons b (NS a (a,b,c) (a,c,(a,b,c)))
@twanvl
twanvl / machinesbench.hs
Created June 7, 2016 21:01
Machines benchmark modified to include vector stream fusion. Addapted from https://gist.github.com/michaelt/f19bef01423b17f29ffd, which is in turn based on https://github.com/ekmett/machines/blob/master/benchmarks/Benchmarks.hs
{-#LANGUAGE NoMonomorphismRestriction #-}
module Main (main) where
import Control.Monad (void)
import Control.Monad.Identity
import Criterion.Main
import qualified Data.Conduit as C
import qualified Data.Conduit.Combinators as CC
import qualified Data.Conduit.List as C
import qualified Data.Machine as M