1signature Susp =
2sig
3(* Susp -- support for lazy evaluation *)
4
5type 'a susp
6
7val delay : (unit -> 'a) -> 'a susp
8val force : 'a susp -> 'a
9
10(*
11   ['a susp] is the type of lazily evaluated expressions with result
12   type 'a.
13
14   [delay (fn () => e)] creates a suspension for the expression e.
15   The first time the suspension is forced, the expression e will be
16   evaluated, and the result stored in the suspension.  All subsequent
17   forcing of the suspension will just return this result, so e is
18   evaluated at most once.  If the suspension is never forced, then e
19   is never evaluated.
20
21   [force su] forces the suspension su and returns the result of the
22   expression e stored in the suspension.
23*)
24end