aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/elab_util.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-04-09 12:31:56 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-04-09 12:31:56 -0400
commita75aaa90b3b827f9ef002491bc081df36260f136 (patch)
treedddbb02bac0b5dae304255f3ba1f8f95d7af21a6 /src/elab_util.sml
parented34aa061c7d9ba68d8f2419b22c2a0b6b6ce812 (diff)
Made type class system very general; demo compiles
Diffstat (limited to 'src/elab_util.sml')
-rw-r--r--src/elab_util.sml19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/elab_util.sml b/src/elab_util.sml
index ff4abbfb..17e67787 100644
--- a/src/elab_util.sml
+++ b/src/elab_util.sml
@@ -244,7 +244,22 @@ fun map {kind, con} s =
S.Return () => raise Fail "ElabUtil.Con.map: Impossible"
| S.Continue (s, ()) => s
-fun exists {kind, con} k =
+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 exists {kind, con} c =
case mapfold {kind = fn k => fn () =>
if kind k then
S.Return ()
@@ -254,7 +269,7 @@ fun exists {kind, con} k =
if con c then
S.Return ()
else
- S.Continue (c, ())} k () of
+ S.Continue (c, ())} c () of
S.Return _ => true
| S.Continue _ => false