|Copyright||(C) 2008-2015 Edward Kmett|
|License||BSD-style (see the file LICENSE)|
|Maintainer||Edward Kmett <email@example.com>|
|Portability||non-portable (fundeps, MPTCs)|
Monads for free.
Monad is one that does no work during the normalization step beyond simply grafting the two monadic values together.
On the other hand, consider:
data Tree a = Bin (Tree a) (Tree a) | Tip a
data Pair a = Pair a a
And we could make an instance of
MonadFree for it directly:
Moreover, Control.Monad.Free.Church provides a
instance that can improve the asymptotic complexity of code that
constructs free monads by effectively reassociating the use of
>>=). You may also want to take a look at the
A version of lift that can be used with just a Functor for f.