effects-0: Computational Effects




data Handler e m a r Source




ret :: a -> m e
fin :: e -> m r

with :: Monad m => Handler e m a r -> (Proxy (ContT e m) -> ContT e m a) -> m rSource

operation :: forall m m' n a r. (m ~ ContT r m', AutoLift m n) => Proxy m -> ((a -> m' r) -> m' r) -> n aSource

run :: Cont a a -> aSource

io :: AutoLift (ContT () IO) n => IO a -> n aSource

type Cont r = ContT r Identity

Continuation monad. Cont r a is a CPS computation that produces an intermediate result of type a within a CPS computation whose final result type is r.

The return function simply creates a continuation which passes the value on.

The >>= operator adds the bound function into the continuation chain.

data ContT r m a

The continuation monad transformer. Can be used to add continuation handling to other monads.


AutoLift' m1 m2 n1 n2 => AutoLift' m1 m2 (ContT r1 n1) (ContT r2 n2) 
(AutoLift' m1 m2 Identity n, Monad m2) => AutoLift' m1 (ContT r m2) Identity (ContT s n) 
(AutoLift' m1 m2 IO n, Monad m2) => AutoLift' m1 (ContT r m2) IO (ContT s n) 
MonadTrans (ContT r) 
Monad (ContT r m) 
Functor (ContT r m) 
Applicative (ContT r m) 
MonadIO m => MonadIO (ContT r m) 

data Proxy m Source

class AutoLift m1 m2 Source


AutoLift' m1 m2 m1 m2 => AutoLift m1 m2