Twelve Monads of Christmas

An overview

Ben Clifford
Twelve Monads of Christmas
1 min readDec 21, 2016

--

So we reach the end of our twelve(ish) monads, or maybe if you are visiting from the future, the beginning.

Some Basics

On Day 1, I emphasised how IO actions are just values and that >>= is always in charge. On Day 2, I showed the fmap and join version of monads, with [] as an example where you can see intermediate steps of a program materialised as values. On Day 3, I used Maybe to introduce a bit of category theory and how monad morphisms let you interpret Maybe actions in [] or in IO. Day 4 talked about monads that add extra parameters or return values, such as Reader.

Specific Monads

Day 5 puzzled over why it is difficult to implement Set as a monad, even though it seems quite like Maybe or []. Day 6 introduces co-routines via Conduit. Day 7 gives an example where it is useful to not have the full power of a monad, Haxl. Day 8 discusses the difficulties in making a list transformer. Skipping ahead a bit, Day 11 brings in some concepts from dependently typed programming to use compile-time proofs of facts only known at runtime.

Building monads

Day 9 introduces free and freer monads and Day 10 extends that give composable effects and interpreters. And finally, Day 12 introduces continuations which you probably shouldn’t use.

There’s a video

I gave an overview at London Haskell, and a video is available on YouTube.

Happy Christmas!

--

--