From 83430cc520eadaffac2ebab258696f9146ada9b0 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 8 Sep 2009 19:42:12 -0400 Subject: 'more' demos working after optimizer fix --- src/mono_util.sml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/mono_util.sml') 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)), -- cgit v1.2.3