free-2.0: Monads for free

PortabilityMPTCs, fundeps
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>

Control.Monad.Free

Description

Free monads

Synopsis

Documentation

class Monad m => MonadFree f m | m -> f whereSource

Methods

wrap :: f (m a) -> m aSource

Instances

(Functor f, MonadFree f m) => MonadFree f (ListT m) 
(Functor f, MonadFree f m) => MonadFree f (IdentityT m) 
(Functor f, MonadFree f m) => MonadFree f (MaybeT m) 
Functor f => MonadFree f (Free f) 
(Functor f, MonadFree f m, Error e) => MonadFree f (ErrorT e m) 
(Functor f, MonadFree f m, Monoid w) => MonadFree f (WriterT w m) 
(Functor f, MonadFree f m, Monoid w) => MonadFree f (WriterT w m) 
(Functor f, MonadFree f m) => MonadFree f (StateT s m) 
(Functor f, MonadFree f m) => MonadFree f (StateT s m) 
(Functor f, MonadFree f m) => MonadFree f (ReaderT e m) 
(Functor f, MonadFree f m, Monoid w) => MonadFree f (RWST r w s m) 
(Functor f, MonadFree f m, Monoid w) => MonadFree f (RWST r w s m) 

data Free f a Source

Constructors

Pure a 
Free (f (Free f a)) 

Instances

MonadTrans Free 
(Functor m, MonadError e m) => MonadError e (Free m) 
(Functor m, MonadReader e m) => MonadReader e (Free m) 
(Functor m, MonadState s m) => MonadState s (Free m) 
(Functor m, MonadWriter e m) => MonadWriter e (Free m) 
Functor f => MonadFree f (Free f) 
Functor f => Monad (Free f) 
Functor f => Functor (Free f) 
(Functor v, MonadPlus v) => MonadPlus (Free v) 
Functor f => Applicative (Free f) 
Foldable f => Foldable (Free f) 
Traversable f => Traversable (Free f) 
Alternative v => Alternative (Free v) 
(Functor m, MonadCont m) => MonadCont (Free m) 
Traversable1 f => Traversable1 (Free f) 
Foldable1 f => Foldable1 (Free f) 
Functor f => Apply (Free f) 
Functor f => Bind (Free f) 
(Eq (f (Free f a)), Eq a) => Eq (Free f a) 
(Ord (f (Free f a)), Ord a) => Ord (Free f a) 
(Read (f (Free f a)), Read a) => Read (Free f a) 
(Show (f (Free f a)), Show a) => Show (Free f a) 

retract :: Monad f => Free f a -> f aSource

 retract . lift = id
 retract . liftF = id

liftF :: Functor f => f a -> Free f aSource

iter :: Functor f => (f a -> a) -> Free f a -> aSource