diff lib/ur/monad.ur @ 1257:fd1a49b51db5

Fix C-mangling of datatype names
author Adam Chlipala <adamc@hcoop.net>
date Sun, 16 May 2010 15:34:24 -0400
parents 79f487f51d9f
children f0909fb3848f
line wrap: on
line diff
--- a/lib/ur/monad.ur	Sat May 15 12:52:34 2010 -0400
+++ b/lib/ur/monad.ur	Sun May 16 15:34:24 2010 -0400
@@ -92,3 +92,15 @@
          return ({nm = p'.1} ++ p.1, p'.2))
      (fn _ => return ({}, i))
      fl
+
+fun appR2 [K] [m] (_ : monad m) [tf1 :: K -> Type] [tf2 :: K -> Type]
+           (f : nm :: Name -> t :: K -> rest :: {K}
+                -> [[nm] ~ rest] =>
+            tf1 t -> tf2 t -> m unit)
+           [r ::: {K}] (fl : folder r) =
+    @Top.fold [fn r :: {K} => $(map tf1 r) -> $(map tf2 r) -> m unit]
+     (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc r1 r2 =>
+         acc (r1 -- nm) (r2 -- nm);
+         f [nm] [t] [rest] ! r1.nm r2.nm)
+     (fn _ _ => return ())
+     fl