summaryrefslogtreecommitdiff
path: root/src/core_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-06-08 16:02:26 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-06-08 16:02:26 -0400
commit813e9aa4d196962f47c784aeedeaf1cddf54dc4f (patch)
treead51ff72c12a5e8287bee29501a6c7953879fdd9 /src/core_util.sml
parente18863bcabc5d185b7fe1fc750bdf0bbdb5a4f78 (diff)
Beta reductions for expressions
Diffstat (limited to 'src/core_util.sml')
-rw-r--r--src/core_util.sml8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core_util.sml b/src/core_util.sml
index c3e8250b..4f0de447 100644
--- a/src/core_util.sml
+++ b/src/core_util.sml
@@ -266,6 +266,14 @@ fun mapfold {kind = fk, con = fc, exp = fe} =
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, ()),