diff src/mono_util.sml @ 196:890a61991263

Lists all the way through
author Adam Chlipala <adamc@hcoop.net>
date Sat, 09 Aug 2008 16:48:32 -0400
parents 8a70e2919e86
children ab86aa858e6c
line wrap: on
line diff
--- a/src/mono_util.sml	Sat Aug 09 12:50:49 2008 -0400
+++ b/src/mono_util.sml	Sat Aug 09 16:48:32 2008 -0400
@@ -52,7 +52,7 @@
         in
             joinL compareFields (xts1, xts2)
         end
-      | (TDatatype (_, n1, _), TDatatype (_, 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
@@ -297,9 +297,13 @@
                      fn vi' =>
                         (DVal vi', loc))
               | DValRec vis =>
-                S.map2 (ListUtil.mapfold (mfvi ctx) vis,
-                     fn vis' =>
-                        (DValRec vis', loc))
+                let
+                    val ctx' = foldl (fn ((x, n, t, _, s), ctx') => bind (ctx', NamedE (x, n, t, NONE, s))) ctx vis
+                in
+                    S.map2 (ListUtil.mapfold (mfvi ctx') vis,
+                         fn vis' =>
+                            (DValRec vis', loc))
+                end
               | DExport (ek, s, n, ts) =>
                 S.map2 (ListUtil.mapfold mft ts,
                         fn ts' =>
@@ -350,7 +354,7 @@
                                         DDatatype (x, n, xncs) =>
                                         let
                                             val ctx = bind (ctx, Datatype (x, n, xncs))
-                                            val t = (TDatatype (classifyDatatype xncs, n, xncs), #2 d')
+                                            val t = (TDatatype (n, ref (classifyDatatype xncs, xncs)), #2 d')
                                         in
                                             foldl (fn ((x, n, to), ctx) =>
                                                       let
@@ -364,7 +368,7 @@
                                         end
                                       | DVal (x, n, t, e, s) => bind (ctx, NamedE (x, n, t, SOME e, s))
                                       | DValRec vis => foldl (fn ((x, n, t, e, s), ctx) =>
-                                                                 bind (ctx, NamedE (x, n, t, SOME e, s))) ctx vis
+                                                                 bind (ctx, NamedE (x, n, t, NONE, s))) ctx vis
                                       | DExport _ => ctx
                             in
                                 S.map2 (mff ctx' ds',