diff src/mono_util.sml @ 126:76a4d69719d8

Tagging (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:38:03 -0400
parents 6230bdd122e7
children f0d3402184d1
line wrap: on
line diff
--- a/src/mono_util.sml	Thu Jul 17 10:23:04 2008 -0400
+++ b/src/mono_util.sml	Thu Jul 17 10:38:03 2008 -0400
@@ -258,16 +258,25 @@
 
         and mfd' ctx (dAll as (d, loc)) =
             case d of
-                DVal (x, n, t, e, s) =>
-                S.bind2 (mft t,
-                      fn t' =>
-                         S.map2 (mfe ctx e,
-                              fn e' =>
-                                 (DVal (x, n, t', e', s), loc)))
+                DVal vi =>
+                S.map2 (mfvi ctx vi,
+                     fn vi' =>
+                        (DVal vi', loc))
+              | DValRec vis =>
+                S.map2 (ListUtil.mapfold (mfvi ctx) vis,
+                     fn vis' =>
+                        (DValRec vis', loc))
               | DExport (s, n, ts) =>
                 S.map2 (ListUtil.mapfold mft ts,
                         fn ts' =>
                            (DExport (s, n, ts'), loc))
+
+        and mfvi ctx (x, n, t, e, s) =
+            S.bind2 (mft t,
+                  fn t' =>
+                     S.map2 (mfe ctx e,
+                          fn e' =>
+                             (x, n, t', e', s)))
     in
         mfd
     end    
@@ -305,6 +314,8 @@
                                 val ctx' =
                                     case #1 d' of
                                         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
                                       | DExport _ => ctx
                             in
                                 S.map2 (mff ctx' ds',