diff src/list_util.sml @ 6:38bf996e1c2e

Check for leftover kind unifs
author Adam Chlipala <adamc@hcoop.net>
date Sat, 26 Jan 2008 16:44:39 -0500
parents 258261a53842
children bfa2e9ae4df8
line wrap: on
line diff
--- a/src/list_util.sml	Sat Jan 26 16:02:47 2008 -0500
+++ b/src/list_util.sml	Sat Jan 26 16:44:39 2008 -0500
@@ -42,4 +42,22 @@
         mf i []
     end
 
+structure S = Search
+
+fun mapfold f =
+    let
+        fun mf ls s =
+            case ls of
+                nil => S.Continue (nil, s)
+              | h :: t =>
+                case f h s of
+                    S.Return x => S.Return x
+                  | S.Continue (h', s) =>
+                    case mf t s of
+                        S.Return x => S.Return x
+                      | S.Continue (t', s) => S.Continue (h' :: t', s)
+    in
+        mf
+    end
+
 end