diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-09-08 19:42:12 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-09-08 19:42:12 -0400 |
commit | 83430cc520eadaffac2ebab258696f9146ada9b0 (patch) | |
tree | 300ddd5b559729aafff0412876a6d507fcfafc28 /src/mono_util.sml | |
parent | 50bbd6df3de3f637fe8bb680ad707a133e976c6e (diff) |
'more' demos working after optimizer fix
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r-- | src/mono_util.sml | 15 |
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)), |