diff options
author | 2012-01-02 16:54:18 -0500 | |
---|---|---|
committer | 2012-01-02 16:54:18 -0500 | |
commit | b01b8ee2e96e7fec30380991ba723558db3666f2 (patch) | |
tree | f5a113f8ec2f039ae07b16cd62fc3ab25adeb339 | |
parent | cf29709cf040f86708b44778858d78d1bc4468c6 (diff) |
Adapt Monoize serialization to handle freshly created variant types
-rw-r--r-- | src/monoize.sml | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/monoize.sml b/src/monoize.sml index 2e663bc3..82e0030c 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -531,7 +531,20 @@ fun fooifyExp fk env = let fun makeDecl n fm = let - val (x, _, xncs) = Env.lookupDatatype env i + val (x, xncs) = + case ListUtil.search (fn (L'.DDatatype [(x, i', xncs)], _) => + if i' = i then + SOME (x, xncs) + else + NONE + | _ => NONE) (!pvarDefs) of + NONE => + let + val (x, _, xncs) = Env.lookupDatatype env i + in + (x, map (fn (x, n, c) => (x, n, Option.map (monoType env) c)) xncs) + end + | SOME v => v val (branches, fm) = ListUtil.foldlMap @@ -543,7 +556,6 @@ fun fooifyExp fk env = fm) | SOME t => let - val t = monoType env t val (arg, fm) = fooify fm ((L'.ERel 0, loc), t) in (((L'.PCon (dk, L'.PConVar n, SOME (L'.PVar ("a", t), loc)), loc), |