diff src/core_util.sml @ 21:067029c748e9

Beta reductions for expressions
author Adam Chlipala <adamc@hcoop.net>
date Sun, 08 Jun 2008 16:02:26 -0400
parents 1ab48e37d0ef
children bfa2e9ae4df8
line wrap: on
line diff
--- a/src/core_util.sml	Sun Jun 08 15:47:44 2008 -0400
+++ b/src/core_util.sml	Sun Jun 08 16:02:26 2008 -0400
@@ -266,6 +266,14 @@
               exp = fn () => fe,
               bind = fn ((), _) => ()} ()
 
+fun mapB {kind, con, exp, bind} ctx e =
+    case mapfoldB {kind = fn k => fn () => S.Continue (kind k, ()),
+                   con = fn ctx => fn c => fn () => S.Continue (con ctx c, ()),
+                   exp = fn ctx => fn e => fn () => S.Continue (exp ctx e, ()),
+                   bind = bind} ctx e () of
+        S.Continue (e, ()) => e
+      | S.Return _ => raise Fail "CoreUtil.Exp.mapB: Impossible"
+
 fun map {kind, con, exp} e =
     case mapfold {kind = fn k => fn () => S.Continue (kind k, ()),
                   con = fn c => fn () => S.Continue (con c, ()),