Mercurial > urweb
comparison lib/top.ur @ 336:34847732cefc
Crud gets column headings
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sat, 13 Sep 2008 20:04:28 -0400 |
parents | 9601c717d2f3 |
children | 075b36dbb1a4 |
comparison
equal
deleted
inserted
replaced
335:bc5015b89dd2 | 336:34847732cefc |
---|---|
6 | 6 |
7 fun compose (t1 ::: Type) (t2 ::: Type) (t3 ::: Type) (f1 : t2 -> t3) (f2 : t1 -> t2) (x : t1) = f1 (f2 x) | 7 fun compose (t1 ::: Type) (t2 ::: Type) (t3 ::: Type) (f1 : t2 -> t3) (f2 : t1 -> t2) (x : t1) = f1 (f2 x) |
8 | 8 |
9 fun txt (t ::: Type) (ctx ::: {Unit}) (use ::: {Type}) (sh : show t) (v : t) = cdata (show sh v) | 9 fun txt (t ::: Type) (ctx ::: {Unit}) (use ::: {Type}) (sh : show t) (v : t) = cdata (show sh v) |
10 | 10 |
11 fun foldTR (tf :: Type -> Type) (tr :: {Type} -> Type) | |
12 (f : nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest | |
13 -> tf t -> tr rest -> tr ([nm = t] ++ rest)) | |
14 (i : tr []) = | |
15 fold [fn r :: {Type} => $(mapTT tf r) -> tr r] | |
16 (fn (nm :: Name) (t :: Type) (rest :: {Type}) (acc : _ -> tr rest) => | |
17 [[nm] ~ rest] => | |
18 fn r => f [nm] [t] [rest] r.nm (acc (r -- nm))) | |
19 (fn _ => i) | |
20 | |
11 fun foldTR2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (tr :: {Type} -> Type) | 21 fun foldTR2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (tr :: {Type} -> Type) |
12 (f : nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest | 22 (f : nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest |
13 -> tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest)) | 23 -> tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest)) |
14 (i : tr []) = | 24 (i : tr []) = |
15 fold [fn r :: {Type} => $(mapTT tf1 r) -> $(mapTT tf2 r) -> tr r] | 25 fold [fn r :: {Type} => $(mapTT tf1 r) -> $(mapTT tf2 r) -> tr r] |
16 (fn (nm :: Name) (t :: Type) (rest :: {Type}) (acc : _ -> _ -> tr rest) => | 26 (fn (nm :: Name) (t :: Type) (rest :: {Type}) (acc : _ -> _ -> tr rest) => |
17 [[nm] ~ rest] => | 27 [[nm] ~ rest] => |
18 fn r1 r2 => f [nm] [t] [rest] r1.nm r2.nm (acc (r1 -- nm) (r2 -- nm))) | 28 fn r1 r2 => f [nm] [t] [rest] r1.nm r2.nm (acc (r1 -- nm) (r2 -- nm))) |
19 (fn _ _ => i) | 29 (fn _ _ => i) |
30 | |
31 fun foldTRX (tf :: Type -> Type) (ctx :: {Unit}) | |
32 (f : nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest | |
33 -> tf t -> xml ctx [] []) = | |
34 foldTR [tf] [fn _ => xml ctx [] []] | |
35 (fn (nm :: Name) (t :: Type) (rest :: {Type}) => | |
36 [[nm] ~ rest] => | |
37 fn r acc => <xml>{f [nm] [t] [rest] r}{acc}</xml>) | |
38 <xml></xml> | |
20 | 39 |
21 fun foldTRX2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (ctx :: {Unit}) | 40 fun foldTRX2 (tf1 :: Type -> Type) (tf2 :: Type -> Type) (ctx :: {Unit}) |
22 (f : nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest | 41 (f : nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest |
23 -> tf1 t -> tf2 t -> xml ctx [] []) = | 42 -> tf1 t -> tf2 t -> xml ctx [] []) = |
24 foldTR2 [tf1] [tf2] [fn _ => xml ctx [] []] | 43 foldTR2 [tf1] [tf2] [fn _ => xml ctx [] []] |