diff src/mono_util.sml @ 919:cc956020801b

'more' demos working after optimizer fix
author Adam Chlipala <adamc@hcoop.net>
date Tue, 08 Sep 2009 19:42:12 -0400
parents 8e540df3294d
children dfe34fad749d
line wrap: on
line diff
--- a/src/mono_util.sml	Tue Sep 08 11:02:53 2009 -0400
+++ b/src/mono_util.sml	Tue Sep 08 19:42:12 2009 -0400
@@ -434,6 +434,21 @@
         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)),