Module Cc


module Cc: sig .. end
Delimited continuations: multi-prompt shift/reset with the polymorphic answertype and variously typed prompts.

type 'a m 
The type of monadic values.
type 'a prompt 
The type of prompts.

Fundamental Functions


val return : 'a -> 'a m
return a_value
val bind : 'a m -> ('a -> 'b m) -> 'b m
bind cc_monad f
val run : 'a m -> 'a

Running the monad



Specific monad morphisms


val new_prompt : unit -> 'a prompt m
new_prompt ()

Create a new prompt that corresponds to the value of the type 'a

val pushP : 'a prompt -> 'a m -> 'a m
pushP prompt m

Push the prompt and execute the computation m

val shiftP : 'a prompt -> (('b m -> 'a m) -> 'a m) -> 'b m
shiftP prompt f

Capture the delimited continuation up to the dynamically closest occurrence of prompt, remove that continuation and execute f c, where c is the reified captured continuation enclosed in its own prompt.