Fri 11 Apr 2008
Today I'd like to talk about free monads.
The free monad of a functor is a monad that is uniquely determined by the functor (up to isomorphism, etc), given by:
data Free f a = Roll (f (Free f a)) | Return a -- newtype Free f a = Free { unfree :: Either a (f (Free f a))) }
Usually the above is written up using a newtype around a sum (Either) so you can write it using nice point-free style, but I think this makes for clearer introduction this way.