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 tthe type of continuations that expect a value of type
'a. -
callcc fapplies
fto the current continuation. This copies the entire stack; hence,callcctakes time proportional to the size of the current stack. -
isolate fcreates a continuation that evaluates
fin an empty context. This is a constant time operation, and yields a constant size stack. -
prepend (k, f)composes a function
fwith a continuationkto create a continuation that first doesfand then doesk. This is a constant time operation. -
throw (k, v)throws value
vto continuationk. This copies the entire stack ofk; hence,throwtakes 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.