next up previous contents
Next: MLton.GC Up: MLton Previous: MLton   Contents


MLton.Cont

signature MLTON_CONT =
   sig
      type 'a t

      val callcc: ('a t -> 'a) -> 'a
      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

apply f to the current continuation. At present, callcc takes time proportional to the current stack size.

prepend (k, f)

compose a function f with a continuation k to create a continuation that first does f and then does k. prepend is a constant time operation.

throw (k, v)

throw value v to continuation k. At present, throw takes time proportional to the size of k.

throw' (k, th)

a generalization of throw that evaluates th () in the context of k. Thus, for example, if th () raises an exception or grabs another continuation, it will see k, not the current continuation.

signature MLTON_EXN =
   sig
      val history: exn -> string list
   end

history e

the file positions that have raised the exception e, in reverse chronological order. A handle expression that implicitly reraises counts as a raise. history will return [] unless the program is compiled with -exn-history true.


next up previous contents
Next: MLton.GC Up: MLton Previous: MLton   Contents