diff options
author | Adam Chlipala <adam@chlipala.net> | 2012-07-25 14:04:59 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2012-07-25 14:04:59 -0400 |
commit | b2f6e6a5501937c58cbd8eb9b5d90ceae0321386 (patch) | |
tree | 65d3f936aeb2cb122bc23fcccb19aa571b296fc7 /src/elab_util.sml | |
parent | 041a250016b69a70a1fa1ab91ef3c2e61908a9db (diff) |
Allow type class instances with hypotheses via local ('let') definitions
Diffstat (limited to 'src/elab_util.sml')
-rw-r--r-- | src/elab_util.sml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/elab_util.sml b/src/elab_util.sml index b799bbc4..97e3b572 100644 --- a/src/elab_util.sml +++ b/src/elab_util.sml @@ -568,6 +568,26 @@ fun mapfold {kind = fk, con = fc, exp = fe} = exp = fn () => fe, bind = fn ((), _) => ()} () +fun existsB {kind, con, exp, bind} ctx e = + 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, ()), + 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 exists {kind, con, exp} k = case mapfold {kind = fn k => fn () => if kind k then |