aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/elab_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-03-28 17:34:57 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-03-28 17:34:57 -0400
commite9b1040a1f27a07afc7b2bf33522b1058163bf2b (patch)
tree07693c3eaedb3b11fb52fdfa8bcf8cc7c8aaecf8 /src/elab_util.sml
parenta6d534b172ccb8eadc24e0e903b196085869800e (diff)
Fun with records
Diffstat (limited to 'src/elab_util.sml')
-rw-r--r--src/elab_util.sml21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/elab_util.sml b/src/elab_util.sml
index 2550f638..56be1328 100644
--- a/src/elab_util.sml
+++ b/src/elab_util.sml
@@ -233,6 +233,27 @@ fun mapfoldB {kind = fk, con = fc, exp = fe, bind} =
fn e' =>
(ECAbs (expl, x, k', e'), loc)))
+ | ERecord xes =>
+ S.map2 (ListUtil.mapfold (fn (x, e) =>
+ S.bind2 (mfc ctx x,
+ fn x' =>
+ S.map2 (mfe ctx e,
+ fn e' =>
+ (x', e'))))
+ xes,
+ fn xes' =>
+ (ERecord xes', loc))
+ | EField (e, c, {field, rest}) =>
+ S.bind2 (mfe ctx e,
+ fn e' =>
+ S.bind2 (mfc ctx c,
+ fn c' =>
+ S.bind2 (mfc ctx field,
+ fn field' =>
+ S.map2 (mfc ctx rest,
+ fn rest' =>
+ (EField (e', c', {field = field', rest = rest'}), loc)))))
+
| EError => S.return2 eAll
in
mfe