1 (* Copyright (C
) 1999-2006, 2008 Henry Cejtin
, Matthew Fluet
, Suresh
2 * Jagannathan
, and Stephen Weeks
.
3 * Copyright (C
) 1997-2000 NEC Research Institute
.
5 * MLton is released under a BSD
-style license
.
6 * See the file MLton
-LICENSE for details
.
9 structure DynamicWind
: DYNAMIC_WIND
=
12 fun try (f
: unit
-> 'a
, k
: 'a
-> 'b
, h
: exn
-> 'b
) =
18 case A (f ()) handle e
=> E e
of
23 fun wind (thunk
, cleanup
: unit
-> unit
) =
24 try (thunk
, fn a
=> (cleanup (); a
), fn e
=> (cleanup (); raise e
))