resumable-exceptions-0.0.0.20100920: A monad transformer for resumable exceptions

Portabilitynon-portable (GHC extensions)
Stabilityexperimental
Maintainernicolas.frisby@gmail.com

Control.Monad.Resumable.Class

Description

A monadic interface for resumable exceptions.

Synopsis

Documentation

class Monad m => MonadResumable req res m | m -> req res whereSource

A monadic interface for resumable exceptions.

Methods

yield :: req -> (res -> m a) -> m aSource

Raise the exception: a request and a resumption to use if the request can be handled.

handle :: m a -> (req -> (res -> m a) -> m a) -> m aSource

Installs a handler to quiesce an exception before it percolates to the higher-level handlers.

Instances

MonadResumable req res m => MonadResumable req res (ContT r m) 
(Error e, MonadResumable req res m) => MonadResumable req res (ErrorT e m) 
MonadResumable req res m => MonadResumable req res (StateT s m) 
(Monoid w, MonadResumable req res m) => MonadResumable req res (WriterT w m) 
MonadResumable req res m => MonadResumable req res (ReaderT r m) 
(Monoid w, MonadResumable req res m) => MonadResumable req res (RWST r w s m) 
Monad m => MonadResumable req res (ResumableT Dynamic req res m) 
Monad m => MonadResumable req res (ResumableT Static req res m) 

signal :: MonadResumable req res m => req -> m resSource

Variation on yield that immediately returns the result.

respond :: MonadResumable req res m => (req -> m res) -> m a -> m aSource

Variation on handle that always applies the resumption.