module Cc:Delimited continuations: multi-prompt shift/reset with the polymorphic answertype and variously typed prompts.sig
..end
type 'a
m
type 'a
prompt
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
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
.