changeset 127:4eb68ed31145

Reducing (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:43:16 -0400
parents 76a4d69719d8
children b04f7422c832
files src/core_util.sml
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/core_util.sml	Thu Jul 17 10:38:03 2008 -0400
+++ b/src/core_util.sml	Thu Jul 17 10:43:16 2008 -0400
@@ -385,9 +385,14 @@
                      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, e, 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 _ => S.return2 dAll
 
         and mfvi ctx (x, n, t, e, s) =
@@ -445,7 +450,7 @@
                                         DCon (x, n, k, c) => bind (ctx, NamedC (x, n, k, SOME c))
                                       | 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)))
+                                        foldl (fn ((x, n, t, e, s), ctx) => bind (ctx, NamedE (x, n, t, NONE, s)))
                                         ctx vis
                                       | DExport _ => ctx
                             in