Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | (* Copyright (C) 1999-2006, 2008 Henry Cejtin, Matthew Fluet, Suresh |
2 | * Jagannathan, and Stephen Weeks. | |
3 | * Copyright (C) 1997-2000 NEC Research Institute. | |
4 | * | |
5 | * MLton is released under a BSD-style license. | |
6 | * See the file MLton-LICENSE for details. | |
7 | *) | |
8 | ||
9 | structure Bool: BOOL = | |
10 | struct | |
11 | datatype bool = datatype bool | |
12 | ||
13 | val not = not | |
14 | ||
15 | fun scan reader state = | |
16 | case reader state of | |
17 | NONE => NONE | |
18 | | SOME(c, state) => | |
19 | case c of | |
20 | #"f" => (case Reader.reader4 reader state of | |
21 | SOME((#"a", #"l", #"s", #"e"), state) => | |
22 | SOME(false, state) | |
23 | | _ => NONE) | |
24 | | #"t" => (case Reader.reader3 reader state of | |
25 | SOME((#"r", #"u", #"e"), state) => | |
26 | SOME(true, state) | |
27 | | _ => NONE) | |
28 | | _ => NONE | |
29 | ||
30 | val fromString = StringCvt.scanString scan | |
31 | ||
32 | val toString = | |
33 | fn true => "true" | |
34 | | false => "false" | |
35 | end | |
36 | ||
37 | structure BoolGlobal: BOOL_GLOBAL = Bool | |
38 | open BoolGlobal |