comparison 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
comparison
equal deleted inserted replaced
21:067029c748e9 22:d8850cc06d24
142 | EApp ((EAbs (_, _, e1), loc), e2) => 142 | EApp ((EAbs (_, _, e1), loc), e2) =>
143 #1 (reduceExp env (subExpInExp (0, e2) e1)) 143 #1 (reduceExp env (subExpInExp (0, e2) e1))
144 | ECApp ((ECAbs (_, _, e1), loc), c) => 144 | ECApp ((ECAbs (_, _, e1), loc), c) =>
145 #1 (reduceExp env (subConInExp (0, c) e1)) 145 #1 (reduceExp env (subConInExp (0, c) e1))
146 146
147 | EField ((ERecord xes, _), (CName x, _), _) =>
148 (case List.find (fn ((CName x', _), _) => x' = x
149 | _ => false) xes of
150 SOME (_, e) => #1 e
151 | NONE => e)
152
147 | _ => e 153 | _ => e
148 154
149 and reduceExp env = U.Exp.mapB {kind = kind, con = con, exp = exp, bind = bind} env 155 and reduceExp env = U.Exp.mapB {kind = kind, con = con, exp = exp, bind = bind} env
150 156
151 fun decl env d = d 157 fun decl env d = d