diff src/mono_util.sml @ 1800:38297294cf98

New NameJs phase, still needing some debugging
author Adam Chlipala <adam@chlipala.net>
date Thu, 02 Aug 2012 18:12:37 -0400
parents 0577be31a435
children c1e3805e604e
line wrap: on
line diff
--- a/src/mono_util.sml	Thu Aug 02 16:33:25 2012 -0400
+++ b/src/mono_util.sml	Thu Aug 02 18:12:37 2012 -0400
@@ -639,6 +639,13 @@
         S.Return () => raise Fail "MonoUtil.Decl.map: Impossible"
       | S.Continue (e, ()) => e
 
+fun foldMap {typ, exp, decl} s d =
+    case mapfold {typ = fn c => fn s => S.Continue (typ (c, s)),
+                  exp = fn e => fn s => S.Continue (exp (e, s)),
+                  decl = fn d => fn s => S.Continue (decl (d, s))} d s of
+        S.Continue v => v
+      | S.Return _ => raise Fail "MonoUtil.Decl.foldMap: Impossible"
+
 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)),