adamc@329
|
1 con idT = fn t :: Type => t
|
adamc@329
|
2 con record = fn t :: {Type} => $t
|
adamc@329
|
3
|
adamc@325
|
4 con mapTT = fn f :: Type -> Type => fold (fn nm t acc => [nm] ~ acc =>
|
adamc@325
|
5 [nm = f t] ++ acc) []
|
adamc@325
|
6
|
adamc@325
|
7 val compose : t1 ::: Type -> t2 ::: Type -> t3 ::: Type
|
adamc@325
|
8 -> (t2 -> t3) -> (t1 -> t2) -> (t1 -> t3)
|
adamc@325
|
9
|
adamc@325
|
10 val txt : t ::: Type -> ctx ::: {Unit} -> use ::: {Type} -> show t -> t
|
adamc@325
|
11 -> xml ctx use []
|
adamc@329
|
12
|
adamc@336
|
13 val foldTR : tf :: (Type -> Type) -> tr :: ({Type} -> Type)
|
adamc@336
|
14 -> (nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
|
adamc@336
|
15 -> tf t -> tr rest -> tr ([nm = t] ++ rest))
|
adamc@336
|
16 -> tr [] -> r :: {Type} -> $(mapTT tf r) -> tr r
|
adamc@336
|
17
|
adamc@329
|
18 val foldTR2 : tf1 :: (Type -> Type) -> tf2 :: (Type -> Type) -> tr :: ({Type} -> Type)
|
adamc@329
|
19 -> (nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
|
adamc@329
|
20 -> tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
|
adamc@329
|
21 -> tr [] -> r :: {Type} -> $(mapTT tf1 r) -> $(mapTT tf2 r) -> tr r
|
adamc@332
|
22
|
adamc@336
|
23 val foldTRX : tf :: (Type -> Type) -> ctx :: {Unit}
|
adamc@336
|
24 -> (nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
|
adamc@336
|
25 -> tf t -> xml ctx [] [])
|
adamc@336
|
26 -> r :: {Type} -> $(mapTT tf r) -> xml ctx [] []
|
adamc@336
|
27
|
adamc@332
|
28 val foldTRX2 : tf1 :: (Type -> Type) -> tf2 :: (Type -> Type) -> ctx :: {Unit}
|
adamc@332
|
29 -> (nm :: Name -> t :: Type -> rest :: {Type} -> [nm] ~ rest
|
adamc@332
|
30 -> tf1 t -> tf2 t -> xml ctx [] [])
|
adamc@332
|
31 -> r :: {Type} -> $(mapTT tf1 r) -> $(mapTT tf2 r) -> xml ctx [] []
|
adamc@334
|
32
|
adamc@334
|
33 val queryX : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
|
adamc@334
|
34 -> sql_query tables exps -> tables ~ exps
|
adamc@334
|
35 -> ($(exps ++ fold (fn nm (fields :: {Type}) acc => [nm] ~ acc => [nm = $fields] ++ acc) [] tables)
|
adamc@334
|
36 -> xml ctx [] [])
|
adamc@334
|
37 -> transaction (xml ctx [] [])
|