Commit | Line | Data |
---|---|---|
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 | ||
8 | structure Result:> RESULT = | |
9 | struct | |
10 | ||
11 | datatype 'a t = | |
12 | No of string | |
13 | | Yes of 'a | |
14 | ||
15 | local | |
16 | open Layout | |
17 | in | |
18 | fun layout layoutA = | |
19 | fn No s => seq[str "No", paren(str s)] | |
20 | | Yes a => seq[str "Yes", paren(layoutA a)] | |
21 | end | |
22 | ||
23 | fun map(r, f) = | |
24 | case r of | |
25 | No s => No s | |
26 | | Yes x => Yes(f x) | |
27 | ||
28 | val isNo = fn No _ => true | _ => false | |
29 | ||
30 | val isYes = fn Yes _ => true | _ => false | |
31 | ||
32 | end |