diff src/reduce.sml @ 22:d8850cc06d24

Reducing known record projections
author Adam Chlipala <adamc@hcoop.net>
date Sun, 08 Jun 2008 16:08:31 -0400
parents 067029c748e9
children 4ab19c19665f
line wrap: on
line diff
--- a/src/reduce.sml	Sun Jun 08 16:02:26 2008 -0400
+++ b/src/reduce.sml	Sun Jun 08 16:08:31 2008 -0400
@@ -144,6 +144,12 @@
       | ECApp ((ECAbs (_, _, e1), loc), c) =>
         #1 (reduceExp env (subConInExp (0, c) e1))
 
+      | EField ((ERecord xes, _), (CName x, _), _) =>
+        (case List.find (fn ((CName x', _), _) => x' = x
+                          | _ => false) xes of
+             SOME (_, e) => #1 e
+           | NONE => e)
+
       | _ => e
 
 and reduceExp env = U.Exp.mapB {kind = kind, con = con, exp = exp, bind = bind} env