summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-17 10:43:16 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-17 10:43:16 -0400
commit2b4515d68b8ae071a1ee1b7febca476a94b9e77b (patch)
treeb90a2ccdb2c67a682684bed7739f4fce0ff8721a /src
parent462c9d472ebe1a585e3bddb103a3f7cf1cdc64e5 (diff)
Reducing (non-mutual) 'val rec'
Diffstat (limited to 'src')
-rw-r--r--src/core_util.sml13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core_util.sml b/src/core_util.sml
index db2fc9f9..9cde8ab9 100644
--- a/src/core_util.sml
+++ b/src/core_util.sml
@@ -385,9 +385,14 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, decl = fd, bind} =
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 @@ fun mapfoldB (all as {bind, ...}) =
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