summaryrefslogtreecommitdiff
path: root/src/core_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-03-16 10:09:01 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-03-16 10:09:01 -0400
commite5e7bbaaae9cde0981c77e488a29e730876964ba (patch)
tree32012eb864854a36e74947956e1133ce84cd64a7 /src/core_util.sml
parenta00e028f21afd87ef9dd3ed143f52fe648275d45 (diff)
Undo an Especialize change that turned out to be unecessary
Diffstat (limited to 'src/core_util.sml')
-rw-r--r--src/core_util.sml17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/core_util.sml b/src/core_util.sml
index 599e1abc..247dd32e 100644
--- a/src/core_util.sml
+++ b/src/core_util.sml
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008, Adam Chlipala
+(* Copyright (c) 2008-2010, Adam Chlipala
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -375,6 +375,21 @@ fun exists {kind, con} k =
S.Return _ => true
| S.Continue _ => false
+fun existsB {kind, con, bind} ctx c =
+ case mapfoldB {kind = fn ctx => fn k => fn () =>
+ if kind (ctx, k) then
+ S.Return ()
+ else
+ S.Continue (k, ()),
+ con = fn ctx => fn c => fn () =>
+ if con (ctx, c) then
+ S.Return ()
+ else
+ S.Continue (c, ()),
+ bind = bind} ctx c () of
+ S.Return _ => true
+ | S.Continue _ => false
+
fun foldMap {kind, con} s c =
case mapfold {kind = fn k => fn s => S.Continue (kind (k, s)),
con = fn c => fn s => S.Continue (con (c, s))} c s of