Free Monad
data Free f a = Pure a | Free (f (Free f a))
instance Functor f => Monad (Free f) where
return = Pure
Free x >>= f = Free (fmap (>>= f) x)
Pure x >>= f = f x
参考链接
https://github.com/lotz84/haskell/blob/master/docs/free-monad.md