Copyright | (c) R. Kent Dybvig, Simon L. Peyton Jones and Amr Sabry |
---|---|
License | MIT |
Maintainer | Dan Doel |
Stability | Experimental |
Portability | Non-portable (rank-2 types, generalized algebraic datatypes) |
Safe Haskell | None |
Language | Haskell98 |
A monadic treatment of delimited continuations.
Adapted from the paper A Monadic Framework for Delimited Continuations, by R. Kent Dybvig, Simon Peyton Jones and Amr Sabry (http://www.cs.indiana.edu/~sabry/papers/monadicDC.pdf)
This module implements the generation of unique prompt names to be used as delimiters.
P, The prompt generation monad
The prompt generation monad. Represents the type of computations that make use of a supply of unique prompts.
MonadReader r m => MonadReader r (P ans m) Source | |
Monad m => MonadState Int (P ans m) Source | |
MonadTrans (P ans) Source | |
Monad m => Monad (P ans m) Source | |
Functor m => Functor (P ans m) Source | |
Monad m => Applicative (P ans m) Source |
The Prompt type
The prompt type, parameterized by two types: * ans : The region identifier, used to ensure that prompts are only used within the same context in which they are created.
- a : The type of values that may be returned
through
a given prompt. For instance, only prompts of type 'Prompt r a' may be pushed onto a computation of type 'CC r a'.
runP :: Monad m => P ans m ans -> m ans Source
Runs a computation that makes use of prompts, yielding a result in the underlying monad.
newPromptName :: Monad m => P ans m (Prompt ans a) Source
Generates a new, unique prompt
eqPrompt :: Prompt ans a -> Prompt ans b -> Equal a b Source
Tests to determine if two prompts are equal. If so, it provides evidence of that fact, in the form of an Equal.