summaryrefslogtreecommitdiff
path: root/src/mono_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-09-08 19:42:12 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-09-08 19:42:12 -0400
commit83430cc520eadaffac2ebab258696f9146ada9b0 (patch)
tree300ddd5b559729aafff0412876a6d507fcfafc28 /src/mono_util.sml
parent50bbd6df3de3f637fe8bb680ad707a133e976c6e (diff)
'more' demos working after optimizer fix
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r--src/mono_util.sml15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml
index e2bed8eb..c660a4a3 100644
--- a/src/mono_util.sml
+++ b/src/mono_util.sml
@@ -434,6 +434,21 @@ fun exists {typ, exp} k =
S.Return _ => true
| S.Continue _ => false
+fun existsB {typ, exp, bind} ctx e =
+ case mapfoldB {typ = fn t => fn () =>
+ if typ t then
+ S.Return ()
+ else
+ S.Continue (t, ()),
+ exp = fn ctx => fn e => fn () =>
+ if exp (ctx, e) then
+ S.Return ()
+ else
+ S.Continue (e, ()),
+ bind = bind} ctx e () of
+ S.Return _ => true
+ | S.Continue _ => false
+
fun foldB {typ, exp, bind} ctx s e =
case mapfoldB {typ = fn t => fn s => S.Continue (t, typ (t, s)),
exp = fn ctx => fn e => fn s => S.Continue (e, exp (ctx, e, s)),