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
commitea0ad8d321ff7dbd659a5b5bfab8e4b81e8b8d47 (patch)
tree300ddd5b559729aafff0412876a6d507fcfafc28 /src/mono_util.sml
parent5e954e635e58d3a7b34d6dc60d7c4aabd1c752f4 (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)),