1 (* Copyright (C
) 1999-2006 Henry Cejtin
, Matthew Fluet
, Suresh
2 * Jagannathan
, and Stephen Weeks
.
4 * MLton is released under a BSD
-style license
.
5 * See the file MLton
-LICENSE for details
.
8 structure ClearablePromise
: CLEARABLE_PROMISE
=
11 datatype 'a t
= T
of (unit
-> 'a
) * 'a Promise
.t
13 fun clear (T (f
, p
)) = Promise
.reset (p
, f
)
15 fun delay f
= T (f
, Promise
.delay f
)
17 exception Force
= Promise
.Force
19 fun force (T (_
, p
)) = Promise
.force p