diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-12-20 14:19:21 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-12-20 14:19:21 -0500 |
commit | a08075494d9c16a349215fbcaefa3e1d14d2e0f9 (patch) | |
tree | b3d519edc46498c2743994fbcf548dd1a2f3e66b /src/mono_util.sml | |
parent | e478b4d432d65b33613a601f71204fc0c656c3db (diff) |
Start of JsComp
Diffstat (limited to 'src/mono_util.sml')
-rw-r--r-- | src/mono_util.sml | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/mono_util.sml b/src/mono_util.sml index 18b5c948..ebc30984 100644 --- a/src/mono_util.sml +++ b/src/mono_util.sml @@ -357,6 +357,13 @@ fun exists {typ, exp} k = S.Return _ => true | S.Continue _ => false +fun foldB {typ, exp, bind} ctx s e = + case mapfoldB {typ = fn t => fn s => S.Continue (t, typ (t, s)), + exp = fn ctx => fn e => fn s => S.Continue (e, exp (ctx, e, s)), + bind = bind} ctx e s of + S.Continue (_, s) => s + | S.Return _ => raise Fail "MonoUtil.Exp.foldB: Impossible" + end structure Decl = struct @@ -433,6 +440,14 @@ fun map {typ, exp, decl} e = S.Return () => raise Fail "MonoUtil.Decl.map: Impossible" | S.Continue (e, ()) => e +fun foldMapB {typ, exp, decl, bind} ctx s d = + case mapfoldB {typ = fn c => fn s => S.Continue (typ (c, s)), + exp = fn ctx => fn e => fn s => S.Continue (exp (ctx, e, s)), + decl = fn ctx => fn d => fn s => S.Continue (decl (ctx, d, s)), + bind = bind} ctx d s of + S.Continue v => v + | S.Return _ => raise Fail "MonoUtil.Decl.foldMapB: Impossible" + end structure File = struct |