summaryrefslogtreecommitdiff
path: root/src/mono_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-29 15:43:17 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-29 15:43:17 -0400
commit846cf3f1661a8c91e40d80382db28c76dceaf1f0 (patch)
treefe42c0c78660d50832719e1ae9fd9cda2d7e603f /src/mono_util.sml
parentcb3b3831a07d6674a5fa02e3e8a1e4329b58cb34 (diff)
Storing datatype constructors in type references past monoize
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r--src/mono_util.sml14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml
index 1232e7dd..a75a0c31 100644
--- a/src/mono_util.sml
+++ b/src/mono_util.sml
@@ -57,7 +57,7 @@ fun compare ((t1, _), (t2, _)) =
in
joinL compareFields (xts1, xts2)
end
- | (TNamed n1, TNamed n2) => Int.compare (n1, n2)
+ | (TDatatype (n1, _), TDatatype (n2, _)) => Int.compare (n1, n2)
| (TFfi (m1, x1), TFfi (m2, x2)) => join (String.compare (m1, m2), fn () => String.compare (x1, x2))
| (TFun _, _) => LESS
@@ -66,8 +66,8 @@ fun compare ((t1, _), (t2, _)) =
| (TRecord _, _) => LESS
| (_, TRecord _) => GREATER
- | (TNamed _, _) => LESS
- | (_, TNamed _) => GREATER
+ | (TDatatype _, _) => LESS
+ | (_, TDatatype _) => GREATER
and compareFields ((x1, t1), (x2, t2)) =
join (String.compare (x1, x2),
@@ -95,7 +95,7 @@ fun mapfold fc =
(x, t')))
xts,
fn xts' => (TRecord xts', loc))
- | TNamed _ => S.return2 cAll
+ | TDatatype _ => S.return2 cAll
| TFfi _ => S.return2 cAll
in
mft
@@ -125,7 +125,7 @@ end
structure Exp = struct
datatype binder =
- NamedT of string * int * typ option
+ Datatype of string * int * (string * int * typ option) list
| RelE of string * typ
| NamedE of string * int * typ * exp option * string
@@ -324,8 +324,8 @@ fun mapfoldB (all as {bind, ...}) =
case #1 d' of
DDatatype (x, n, xncs) =>
let
- val ctx = bind (ctx, NamedT (x, n, NONE))
- val t = (TNamed n, #2 d')
+ val ctx = bind (ctx, Datatype (x, n, xncs))
+ val t = (TDatatype (n, xncs), #2 d')
in
foldl (fn ((x, n, to), ctx) =>
let