contstuff-1.2.6: Fast, easy to use CPS-based monad transformers

Stabilityexperimental
MaintainerErtugrul Soeylemez <es@ertes.de>

Control.ContStuff.Simple

Contents

Description

This module provides all the transformers from Control.ContStuff.Trans, but with a simplified interface, hiding the underlying CPS machinery.

Synopsis

Choice/nondeterminism

type ChoiceT m a = forall r i. ChoiceT r i m aSource

choice :: [a] -> ChoiceT m aSource

findAll :: (Alternative f, Applicative m) => ChoiceT m a -> m (f a)Source

findFirst :: (Alternative f, Applicative m) => ChoiceT m a -> m (f a)Source

listA :: Alternative f => [a] -> f aSource

Turn a list into a computation with alternatives.

Exceptions

type EitherT e m a = forall r. EitherT r e m aSource

evalEitherT :: Applicative m => EitherT e m a -> m (Either e a)Source

type MaybeT m a = forall r. MaybeT r m aSource

Reader

data ReaderT e m a Source

Monad transformer for computations with readable environment. Unlike the other monad transformers this one allows no CPS effects and also hides its constructors, which makes it commutative.

If you need CPS effects, consider using StateT.

Instances

runReaderT :: Applicative m => e -> ReaderT e m a -> m aSource

Run a computation with environment.

State

type StateT s m a = forall r. StateT r s m aSource

evalStateT :: Applicative m => s -> StateT s m a -> m aSource

execStateT :: Applicative m => s -> StateT s m a -> m sSource

Writer

type WriterT w m a = forall r. OldWriterT r w m aSource

runWriterT :: (Applicative m, Monoid w) => WriterT w m a -> m (a, w)Source

evalWriterT :: (Applicative m, Monoid w) => WriterT w m a -> m aSource

execWriterT :: (Applicative m, Monoid w) => WriterT w m a -> m wSource

Reexports