diff options
Diffstat (limited to 'general.sml')
-rw-r--r-- | general.sml | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/general.sml b/general.sml deleted file mode 100644 index cb4652a..0000000 --- a/general.sml +++ /dev/null @@ -1,32 +0,0 @@ -exception Unreachable - -fun $ (x, y) = x y -infixr 0 $ - -fun printLn s = (print s; print "\n") - -(* All global values which computations may raise an exception must be - * wrapped in lazy, so that no exception is thrown before custom - * top-level handler is set. - *) -fun lazy thunk = -let - datatype 'a value = - Unevaluated of unit -> 'a | - Evaluated of 'a | - Exn of exn - - val value = ref $ Unevaluated thunk -in - fn () => - case !value of - Unevaluated th => - let - val x = th () handle e => (value := Exn e; raise e) - in - value := Evaluated x; - x - end - | Evaluated v => v - | Exn e => raise e -end |