aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/elab_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 21:19:43 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 21:19:43 -0400
commit047a2f193646e08db526768dca8376b7270eecb5 (patch)
tree2be405017cad5af57826b17c1715d9579eb06d1b /src/elab_util.sml
parent9a22207b565607db64f95dda5fdc1c9e56224ec9 (diff)
Almost have that nested save function compiling
Diffstat (limited to 'src/elab_util.sml')
-rw-r--r--src/elab_util.sml21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/elab_util.sml b/src/elab_util.sml
index 2e190d1e..57a94486 100644
--- a/src/elab_util.sml
+++ b/src/elab_util.sml
@@ -375,14 +375,19 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, bind} =
| ELet (des, e) =>
let
val (des, ctx) = foldl (fn (ed, (des, ctx)) =>
- (S.bind2 (des,
- fn des' =>
- S.map2 (mfed ctx ed,
+ let
+ val ctx' =
+ case #1 ed of
+ EDVal (x, t, _) => bind (ctx, RelE (x, t))
+ | EDValRec vis =>
+ foldl (fn ((x, t, _), ctx) => bind (ctx, RelE (x, t))) ctx vis
+ in
+ (S.bind2 (des,
+ fn des' =>
+ S.map2 (mfed ctx ed,
fn ed' => des' @ [ed'])),
- case #1 ed of
- EDVal (x, t, _) => bind (ctx, RelE (x, t))
- | EDValRec vis =>
- foldl (fn ((x, t, _), env) => bind (ctx, RelE (x, t))) ctx vis))
+ ctx')
+ end)
(S.return2 [], ctx) des
in
S.bind2 (des,
@@ -400,7 +405,7 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, bind} =
(EDVal vi', loc))
| EDValRec vis =>
let
- val ctx = foldl (fn ((x, t, _), env) => bind (ctx, RelE (x, t))) ctx vis
+ val ctx = foldl (fn ((x, t, _), ctx) => bind (ctx, RelE (x, t))) ctx vis
in
S.map2 (ListUtil.mapfold (mfvi ctx) vis,
fn vis' =>