diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-09-07 11:33:13 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-09-07 11:33:13 -0400 |
commit | 5cf1d4d086475575a31f57413c57c22bd6fda378 (patch) | |
tree | ab36ce67d2931f2c715b5b734930139c53adc670 /src/mono_util.sml | |
parent | 42c284b9204ef5dfc249cc7273ff2eaa9304e9e6 (diff) |
Converting string to int
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r-- | src/mono_util.sml | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml index f3604cf3..b2fdff52 100644 --- a/src/mono_util.sml +++ b/src/mono_util.sml @@ -50,6 +50,7 @@ fun compare ((t1, _), (t2, _)) = end | (TDatatype (n1, _), TDatatype (n2, _)) => Int.compare (n1, n2) | (TFfi (m1, x1), TFfi (m2, x2)) => join (String.compare (m1, m2), fn () => String.compare (x1, x2)) + | (TOption t1, TOption t2) => compare (t1, t2) | (TFun _, _) => LESS | (_, TFun _) => GREATER @@ -60,6 +61,9 @@ fun compare ((t1, _), (t2, _)) = | (TDatatype _, _) => LESS | (_, TDatatype _) => GREATER + | (TFfi _, _) => LESS + | (_, TFfi _) => GREATER + and compareFields ((x1, t1), (x2, t2)) = join (String.compare (x1, x2), fn () => compare (t1, t2)) @@ -88,6 +92,10 @@ fun mapfold fc = fn xts' => (TRecord xts', loc)) | TDatatype _ => S.return2 cAll | TFfi _ => S.return2 cAll + | TOption t => + S.map2 (mft t, + fn t' => + (TOption t, loc)) in mft end @@ -186,6 +194,8 @@ fun mapfoldB {typ = fc, exp = fe, bind} = | PCon (_, _, SOME p) => pb (p, ctx) | PRecord xps => foldl (fn ((_, p, _), ctx) => pb (p, ctx)) ctx xps + | PNone _ => ctx + | PSome (_, p) => pb (p, ctx) in S.map2 (mfe (pb (p, ctx)) e, fn e' => (p, e')) |