signature MLTON_CONT =
sig
type 'a t
val callcc: ('a t -> 'a) -> 'a
val isolate: ('a -> unit) -> 'a t
val prepend: 'a t * ('b -> 'a) -> 'b t
val throw: 'a t * 'a -> 'b
val throw': 'a t * (unit -> 'a) -> 'b
end
-
type 'a t
the type of continuations that expect a value of type
'a
. -
callcc f
applies
f
to the current continuation. This copies the entire stack; hence,callcc
takes time proportional to the size of the current stack. -
isolate f
creates a continuation that evaluates
f
in an empty context. This is a constant time operation, and yields a constant size stack. -
prepend (k, f)
composes a function
f
with a continuationk
to create a continuation that first doesf
and then doesk
. This is a constant time operation. -
throw (k, v)
throws value
v
to continuationk
. This copies the entire stack ofk
; hence,throw
takes time proportional to the size of this stack. -
throw' (k, th)
a generalization of throw that evaluates
th ()
in the context ofk
. Thus, for example, ifth ()
raises an exception or captures another continuation, it will seek
, not the current continuation.