summaryrefslogtreecommitdiff
path: root/lib/top.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-09-13 11:13:46 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-09-13 11:13:46 -0400
commit14c2a9e4b84d7344b40c7398c8896338939bfcc1 (patch)
treed4a6d210fcc14e26dd25bc5e1ac23fc640eee299 /lib/top.ur
parentfd2079464d7b65430af09f2734fa55039006a3e3 (diff)
foldTRX2
Diffstat (limited to 'lib/top.ur')
-rw-r--r--lib/top.ur9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/top.ur b/lib/top.ur
index d94f8bf6..af009242 100644
--- a/lib/top.ur
+++ b/lib/top.ur
@@ -17,3 +17,12 @@ fun foldTR2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (tr :: {Type} -> Type)
[[nm] ~ rest] =>
fn r1 r2 => f [nm] [t] [rest] r1.nm r2.nm (acc (r1 -- nm) (r2 -- nm)))
(fn _ _ => i)
+
+fun foldTRX2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (ctx :: {Unit})
+ (f : nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
+ -> tf1 t -> tf2 t -> xml ctx [] []) =
+ foldTR2 [tf1] [tf2] [fn _ => xml ctx [] []]
+ (fn (nm :: Name) (t :: Type) (rest :: {Type}) =>
+ [[nm] ~ rest] =>
+ fn r1 r2 acc => <xml>{f [nm] [t] [rest] r1 r2}{acc}</xml>)
+ <xml></xml>