diff options
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r-- | src/mono_util.sml | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml index 61638858..116dfa64 100644 --- a/src/mono_util.sml +++ b/src/mono_util.sml @@ -1,4 +1,4 @@ -(* Copyright (c) 2008, Adam Chlipala +(* Copyright (c) 2008, 2013, Adam Chlipala * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -654,6 +654,25 @@ fun foldMapB {typ, exp, decl, bind} ctx s d = S.Continue v => v | S.Return _ => raise Fail "MonoUtil.Decl.foldMapB: Impossible" +fun exists {typ, exp, decl} k = + case mapfold {typ = fn c => fn () => + if typ 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, ())} k () of + S.Return _ => true + | S.Continue _ => false + end structure File = struct |