summaryrefslogtreecommitdiff
path: root/src/core_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-27 12:43:28 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-27 12:43:28 -0500
commit960a42fc1844d5f0f6033b3caada6349d588a2a9 (patch)
treeee3ca9390d833115cec329bfd2c1c7bc7b13e5b6 /src/core_util.sml
parent82dca6c875cca25d05dfbd5c6a2fb2185b965692 (diff)
Avoid Especializing polymorphic code
Diffstat (limited to 'src/core_util.sml')
-rw-r--r--src/core_util.sml24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/core_util.sml b/src/core_util.sml
index 71efe16e..02cb86ca 100644
--- a/src/core_util.sml
+++ b/src/core_util.sml
@@ -900,6 +900,30 @@ fun foldMapB {kind, con, exp, decl, bind} ctx s d =
S.Continue v => v
| S.Return _ => raise Fail "CoreUtil.Decl.foldMapB: Impossible"
+fun exists {kind, con, exp, decl} d =
+ case mapfold {kind = fn k => fn () =>
+ if kind k then
+ S.Return ()
+ else
+ S.Continue (k, ()),
+ con = fn c => fn () =>
+ if con c then
+ S.Return ()
+ else
+ S.Continue (c, ()),
+ exp = fn e => fn () =>
+ if exp e then
+ S.Return ()
+ else
+ S.Continue (e, ()),
+ decl = fn d => fn () =>
+ if decl d then
+ S.Return ()
+ else
+ S.Continue (d, ())} d () of
+ S.Return _ => true
+ | S.Continue _ => false
+
end
structure File = struct