Import Upstream version 20180207
[hcoop/debian/mlton.git] / lib / mlton / basic / escape.sml
CommitLineData
7f918cf1
CE
1(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 *
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
6 *)
7
8structure Escape: ESCAPE =
9struct
10
11type 'a t = 'a -> exn
12
13fun escape (e, a) = raise (e a)
14
15fun new (f: 'a t -> 'a): 'a =
16 let exception E of 'a
17 in f E handle E a => a
18 end
19
20end