diff options
Diffstat (limited to 'src/nbc/promise.sml')
-rw-r--r-- | src/nbc/promise.sml | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/nbc/promise.sml b/src/nbc/promise.sml deleted file mode 100644 index 6bb2655..0000000 --- a/src/nbc/promise.sml +++ /dev/null @@ -1,24 +0,0 @@ -structure Promise -:> sig - type 'fulfillment promise - val delay: (unit -> 'fulfillment) -> 'fulfillment promise - val force: 'fulfillment promise -> 'fulfillment -end = struct - local - datatype 'expectation lazy = - Delayed of unit -> 'expectation - | Forced of 'expectation - in - type 'expectation promise = 'expectation lazy ref - fun delay fulfill = ref (Delayed fulfill) - fun force promise = case !promise of - Delayed fulfill => - let - val expectation = fulfill () - in - promise := Forced expectation - ; expectation - end - | Forced expectation => expectation - end -end |