aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/ur/top.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-09-15 10:18:56 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-09-15 10:18:56 -0400
commit44eb43907a88455c0cf223a411860a27d59c78b6 (patch)
treeb81fba316b6a552d9b1cf527831175d0926da43f /lib/ur/top.ur
parenta8fa8a4567570b1925ff11b17da729ac32cd191e (diff)
Summary row with aggregates
Diffstat (limited to 'lib/ur/top.ur')
-rw-r--r--lib/ur/top.ur7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index 7073884f..67e75573 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -105,6 +105,13 @@ fun map2 [K] [tf1 :: K -> Type] [tf2 :: K -> Type] [tf3 :: K -> Type]
acc (r1 -- nm) (r2 -- nm) ++ {nm = f r1.nm r2.nm})
(fn _ _ => {})
+fun map3 [K] [tf1 :: K -> Type] [tf2 :: K -> Type] [tf3 :: K -> Type] [tf :: K -> Type]
+ (f : t ::: K -> tf1 t -> tf2 t -> tf3 t -> tf t) [r :: {K}] (fl : folder r) =
+ fl [fn r :: {K} => $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> $(map tf r)]
+ (fn [nm :: Name] [t :: K] [rest :: {K}] [[nm] ~ rest] acc r1 r2 r3 =>
+ acc (r1 -- nm) (r2 -- nm) (r3 -- nm) ++ {nm = f r1.nm r2.nm r3.nm})
+ (fn _ _ _ => {})
+
fun foldUR [tf :: Type] [tr :: {Unit} -> Type]
(f : nm :: Name -> rest :: {Unit}
-> [[nm] ~ rest] =>