diff src/elab_util.sml @ 12:d89477f07c1e

Fun with records
author Adam Chlipala <adamc@hcoop.net>
date Fri, 28 Mar 2008 17:34:57 -0400
parents e97c6d335869
children 6049e2193bf2
line wrap: on
line diff
--- a/src/elab_util.sml	Fri Mar 28 15:20:46 2008 -0400
+++ b/src/elab_util.sml	Fri Mar 28 17:34:57 2008 -0400
@@ -233,6 +233,27 @@
                               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