definitive-base-2.6.3: A small Prelude wrapper to simplify my own Haskell developments

Safe HaskellNone
LanguageHaskell2010

Algebra.Monad.Cont

Contents

Synopsis

The MonadCont class

class Monad m => MonadCont m where Source #

Minimal complete definition

callCC

Methods

callCC :: (forall b. (a -> m b) -> m b) -> m a Source #

Instances

MonadCont (ContT m) Source # 

Methods

callCC :: (forall b. (a -> ContT m b) -> ContT m b) -> ContT m a Source #

MonadCont m => MonadCont (ReaderT r m) Source # 

Methods

callCC :: (forall b. (a -> ReaderT r m b) -> ReaderT r m b) -> ReaderT r m a Source #

MonadCont m => MonadCont (StateT s m) Source # 

Methods

callCC :: (forall b. (a -> StateT s m b) -> StateT s m b) -> StateT s m a Source #

(MonadCont m, Monoid w) => MonadCont (WriterT w m) Source # 

Methods

callCC :: (forall b. (a -> WriterT w m b) -> WriterT w m b) -> WriterT w m a Source #

(Monoid w, MonadCont m) => MonadCont (RWST r w s m) Source # 

Methods

callCC :: (forall b. (a -> RWST r w s m b) -> RWST r w s m b) -> RWST r w s m a Source #

The Continuation transformer

newtype ContT m a Source #

A simple continuation monad implementation

Constructors

ContT 

Fields

  • runContT :: forall r. (a -> m r) -> m r
     

Instances

MonadTrans ContT Source # 

Methods

lift :: Monad m => m a -> ContT m a Source #

Unit (ContT m) Source # 

Methods

pure :: a -> ContT m a Source #

MonadCont (ContT m) Source # 

Methods

callCC :: (forall b. (a -> ContT m b) -> ContT m b) -> ContT m a Source #

MonadFix m => MonadFix (ContT m) Source # 

Methods

mfix :: (a -> ContT m a) -> ContT m a Source #

Monad (ContT m) Source # 

Methods

join :: ContT m (ContT m a) -> ContT m a Source #

(>>=) :: ContT m a -> (a -> ContT m b) -> ContT m b Source #

Applicative (ContT m) Source # 
SemiApplicative (ContT m) Source # 

Methods

(<*>) :: ContT m (a -> b) -> ContT m a -> ContT m b Source #

Functor (ContT f) Source # 

Methods

map :: (a -> b) -> ContT f a -> ContT f b Source #

type Cont a = ContT Id a Source #

contT :: (Monad m, Unit m') => Iso (ContT m a) (ContT m' a') (m a) (m' a') Source #

cont :: Iso (Cont a) (Cont a') a a' Source #

(>>~) :: ContT m a -> (a -> m b) -> m b Source #