continue-0.2.0: Monads with suspension and arbitrary-spot reentry

MaintainerErtugrul Soeylemez <es@ertes.de>
Safe HaskellNone

Control.Monad.Continue.Class

Contents

Description

 

Synopsis

Suspension

class (Plus f, Monad m, Monoid e) => MonadContinue e f m | m -> e, m -> f whereSource

Type class for monads that support suspension and continuation spots.

Methods

addContSource

Arguments

:: Either e a

What to return now (left suspends).

-> f (m a)

What to run and return when reentering.

-> m a 

Add the given set of continuations and possibly suspend.

Instances

MonadContinue e f m => MonadContinue e f (MaybeT m) 
MonadContinue e f m => MonadContinue e f (IdentityT m) 
(MonadContinue e f m, Monoid l) => MonadContinue e f (WriterT l m) 
(MonadContinue e f m, Monoid l) => MonadContinue e f (WriterT l m) 
MonadContinue e f m => MonadContinue e f (StateT s m)

Time travel warning: Captures the current state, not the state at reentry. Use ContinueT over StateT instead to fix this.

MonadContinue e f m => MonadContinue e f (StateT s m)

Time travel warning: Captures the current state, not the state at reentry. Use ContinueT over StateT instead to fix this.

MonadContinue e f m => MonadContinue e f (ReaderT r m) 
(Monad m, Monoid e, Plus f) => MonadContinue e f (ContinueT e f m) 

Basic utilities

addCont_ :: MonadContinue e f m => f (m ()) -> m ()Source

Add the given set of continuations without suspending.

continueSource

Arguments

:: MonadContinue e f m 
=> Either e a

What to return now (left suspends).

-> f (Either e a)

What to return when reentering (left suspends).

-> m a 

Allow to continue here with the given value.

continue_Source

Arguments

:: MonadContinue e f m 
=> f ()

Reentering key.

-> m () 

Allow to continue here.

suspend :: MonadContinue e f m => e -> m aSource

Suspend with the given value. Does not register any continuation spots. Note that suspend mempty is equivalent to empty.

suspendWith :: MonadContinue e f m => f (m a) -> m aSource

Suspend with mempty and register the given continuations. Note that suspendWith zero is equivalent to empty.