import qualified Data.Set as Set 

data Foo = Bar | Biz deriving Show

main :: IO ()
main = do
    print "hello world"
    print [2 * i | i <- [1.. 10] ]
    let x = 2 * pi
    print Biz
    print x
    let x = Set.fromList [1,2,3] -- Set.empty Set.singleton
    print $ Set.member 4 (Set.insert 4 x) 



containers oh yeah. Is it still a thing that good strings are a package?


aeson json needs

bizarro verse




Functor Games


Recursion Schemes and F-Algebras


A different category

f a -> a

  • objects are haskell functions of this type and the type a. Again a bizarre (depending on your background) mixing of values and types
  • morphisms are squares. Very very weird.

a -> f a

Initiality Bananases barbed wire


return :: a -> m a
(>>=) :: m a -> (a -> m b) -> m b

“monoid in the category of endofunctors”

type constructors are endofunctors. A functor is

  1. a mapping ofobjects
  2. a mapping of morphisms

The standard model of category theory in haskell is

  1. types are objects
  2. morphisms are functions

Composition is (.). id are identity morphisms.

Note how weird this is. We’ve in some sense put types and values (haskell functions are values that inhabit function types) on the same level.

Maybe maps any type a to the the Maybe a


Free Monads

Monad Transformers

Algebraic Effects



Free theorems Jaseklioff and higher kinded versions of parametrcity

Algebra of Programming

Algerba of programming book Backhouse

Point free

Bird and Gibbons Algorithm Design with Haskell

Mathematics of program construction

program desgin by calculation

Category Theory

Compiling to categories

STG and low level

Low level ocaml and haskell

The STG. It’s curiously like a Bohm mararducci or finally tagless. Constructors are function points. I mean. They’re both called tagless. push-enter vs eval-apply continuation primop crazy slides on the full stack stg interpeter. but also a good read –ddump-ds –ddump-stg Optimization handbook

+RTS flags. There is a runtime you know.

Debug.trace info table profiling. You can know what code line allocated data dwarf and ghc

Unboxed types

kinds are calling conventions levity polymorphism


Alexis King on laziness

We can ssume the result of a function is demanded. If you return a structure, the arguments aren’t necessarily demanded bang patterns

why laziness thread take 10 . sort where clauses only make sense because let kind of float / are unordered pure memoization Define toplevel stream of answers, memo function just indexes ito ths toplevel stream. However, this is linear time lookup. So MemoTrie

circular programming

why is lazy evaluation useful

Knot Tying


higher rank types liquid haskell

gadts datakinds


impredicative types a quicklook

Typelevel Programming

higher order typelevel programming Did these matchable arrows make it in


Pipes etc

Pearls emily pillmore’s list of papers

Generalizing generalized tries

Fun with semirings

Power serious

parser combinators

impossible functional programs

import qualified Data.Set as Set
import qualified Data.Map.Strict as Map
import qualified Data.Sequence as Seq

main = print "hello"

-- Trie a b 
data Trie a = All -- Hmm. Put a result here? 
  -- | None  -- None is Proj (empty)
  | Skip (Trie a)  -- Skip Int (Trie a) compressed skip
  | Proj (Map.Map a (Trie a)) -- Proj Int Map.Map 
   -- | None (Trie a) ???
  deriving (Eq, Ord)

data Trie { [Int]} skip list factored out.

Wel typed form

data Trie a b = All b | Proj (Map a b)

type = Trie Int (Trie Char ())


instance Functor Trie where
  fmap f All = All
  fmap f (Skip x) = Skip (fmap f x)
  fmap f (Proj m) = Proj (fmap f m)

join :: Ord a => Trie a -> Trie a -> Trie a
join All x = x
join x All = x
join (Skip x) (Skip y) = (Skip (join x y))
join (Proj x) (Proj y) = (Proj (Map.intersectionWith join x y))
join (Skip x) (Proj y) = Proj $ fmap (\ y -> join x y) y
join (Proj x) (Skip y) = Proj $ fmap (\ x -> join x y) x

full = All

-- insert

union :: Ord a => Trie a -> Trie a -> Trie a
union All x = All
union x All = All
union (Skip x) (Skip y) = (Skip (union x y))
union (Proj x) (Proj y) = (Proj (Map.unionWith union x y))
union (Skip x) (Proj y) = ? -- hmm. maybe there's nothing
union (Proj x) (Skip y) = ?

singleton :: [Maybe a]  -> Trie a
singleton [] = All
singleton (Nothing:xs) = Skip (singleton xs)
singleton ((Just x) : xs) = Proj (Map.singleton x (singleton xs))

lookup k (Skip m) = m
lookup k All = All
lookup k (Proj m) = Map.lookup k m

singleton' :: [Either a Int] -> Trie a
singleton' [] = All
singleton' (Left x : xs) = Proj (Map.singleton x (singleton' xs))
singleton' (Right n : xs) = Proj (Map.singleton x (singleton' xs))
-- ixy :: [(Int,a)] -> [Maybe a] 
-- ixy :: [a] -> [Int] -> [Maybe a]
trie :: [[a]] -> [Int] -> Trie a
trie ls ixs = 
  foldl ls


map :: (Trie a -> Trie a) -> Trie a  -- map?

collapse :: Trie a -> Trie a
collapse All = All
collapse (Skip m) = m
collapse (Proj m) = Map.mapWithKey (\k m' -> lookup k m') 

swap :: Trie a -> Trie a
swap All = All
swap (Skip (Proj m)) = Proj (map (\k -> Skip k) m)
swap t@(Skip (Skip m)) = t
swap (Proj m) = 


So... it's partial maps over lists of stuff.
They're kind of more like ZDDs

fresh :: State Int (Trie a)

rel1 :: Set a -> Int -> Trie a
rel1 s 0 = 

rel2 :: Set (a,a) -> Int -> Int -> Trie a
rel2 s i j | i == j    = rel1 (filter (==)  s)
           | i < j     = 
           | otherwise = 
rel3 :: Set (a,a,a) -> Int -> Int -> Int -> Trie a

Resources microhaskell augustsson

native delim contby alexis king recursion schemes and comonads - Tielen The Foil: Capture-Avoiding Substitution With No Sharp Edges

secrets of the ghc inliner

Haskell Wiki book


Conal Elliott

  • Compiling to categories
  • Generalized convolution and efficient language recognition
  • The simple essence of automatic differentiation
  • Generic parallel functional programming


Brent Yorgey Species

Sjoerd Kmett

Ben Lynn Gershom Bazerman Alexis King

Oleg Kiselyov Ralf Hinze Dan Piponi

Jules Hedges - games, selection monad

Joachim Breitner - more fixpoints

Matthew Pickering Emily Pillmore Nicholas Wu Jeremy Gibbons Schrijvers Andres Loh Simon Peyton Jones Wouter Swierstra richard eisenberg stephanie weirich

observable equality

comonad reader

haskell symposium

production haskell effective haskell learn you a haskell for great good

Diehl - what I wish I had known learning haskell

Algebraic graphs

Fun with semiring physics and functional programming

evolution of haskell programmer

Go through old notes haskell and automata


  • tweag
  • well-typed
  • serokell

Top stack exchange questions by vote