| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Control.Monad.Trans.Free
Description
The Free monad
type Free f = FreeT f Identity Source #
The Free type is isomorphic to:
data Free f r = Pure r | Wrap (f (Free f r))
... except that if you want to pattern match against those constructors, you
must first use runFree to unwrap the value first.
Similarly, you don't use the raw constructors to build a value of type
Free. You instead use the smart constructors pure (from
Control.Applicative) and wrap.
The FreeT monad transformer
A free monad transformer alternates nesting the base functor f and the
base monad m.
f- The functor that generates the free monadm- The base monadr- The type of the return value
This type commonly arises in coroutine/iteratee libraries under various names.