comparison lib/top.ur @ 332:02d15d81ae9b

foldTRX2
author Adam Chlipala <adamc@hcoop.net>
date Sat, 13 Sep 2008 11:13:46 -0400
parents f307cdd08d81
children 9601c717d2f3
comparison
equal deleted inserted replaced
331:41458a694575 332:02d15d81ae9b
15 fold [fn r :: {Type} => $(mapTT tf1 r) -> $(mapTT tf2 r) -> tr r] 15 fold [fn r :: {Type} => $(mapTT tf1 r) -> $(mapTT tf2 r) -> tr r]
16 (fn (nm :: Name) (t :: Type) (rest :: {Type}) (acc : _ -> _ -> tr rest) => 16 (fn (nm :: Name) (t :: Type) (rest :: {Type}) (acc : _ -> _ -> tr rest) =>
17 [[nm] ~ rest] => 17 [[nm] ~ rest] =>
18 fn r1 r2 => f [nm] [t] [rest] r1.nm r2.nm (acc (r1 -- nm) (r2 -- nm))) 18 fn r1 r2 => f [nm] [t] [rest] r1.nm r2.nm (acc (r1 -- nm) (r2 -- nm)))
19 (fn _ _ => i) 19 (fn _ _ => i)
20
21 fun foldTRX2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (ctx :: {Unit})
22 (f : nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
23 -> tf1 t -> tf2 t -> xml ctx [] []) =
24 foldTR2 [tf1] [tf2] [fn _ => xml ctx [] []]
25 (fn (nm :: Name) (t :: Type) (rest :: {Type}) =>
26 [[nm] ~ rest] =>
27 fn r1 r2 acc => <xml>{f [nm] [t] [rest] r1 r2}{acc}</xml>)
28 <xml></xml>