monad-levels-0.1.0.1: Specific levels of monad transformers

Copyright(c) Ivan Lazar Miljenovic
License3-Clause BSD-style
MaintainerIvan.Miljenovic@gmail.com
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Levels.Cont

Description

This module allows inclusion of ContT into your monad stack so as to represent continuation-passing style (CPS) computations.

Note that the behaviour of some monad transformers and how they deal with continuations differs from how mtl handles them. For example, with a lazy state transformer, using this module results in liftCallCC, whereas mtl uses liftCallCC'.

Synopsis

Documentation

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

callCC (call-with-current-continuation) calls a function with the current continuation as its argument.

newtype ContT r m a :: * -> (* -> *) -> * -> *

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

Constructors

ContT 

Fields

runContT :: (a -> m r) -> m r
 

type HasCont m a b = SatisfyConstraintF IsCont m a (ContFn b) Source

Represents monad stacks that can successfully pass callCC down to a ContT transformer.

class MonadLevel m => IsCont m Source

A simple class just to match up with the ContT monad transformer.

type ContFn b = MkVarFn (Func (Func ValueOnly (MonadicOther b)) MonadicValue) Source

This corresponds to CallCC in transformers.