comparison lib/ur/top.urs @ 602:1d34d916c206

Combine lib* directories
author Adam Chlipala <adamc@hcoop.net>
date Tue, 13 Jan 2009 15:23:48 -0500
parents lib/top.urs@7cb418e9714f
children 8998114760c1
comparison
equal deleted inserted replaced
601:7c3c21eb5b4c 602:1d34d916c206
1 val not : bool -> bool
2
3 con idT = fn t :: Type => t
4 con record = fn t :: {Type} => $t
5 con fstTT = fn t :: (Type * Type) => t.1
6 con sndTT = fn t :: (Type * Type) => t.2
7 con fstTTT = fn t :: (Type * Type * Type) => t.1
8 con sndTTT = fn t :: (Type * Type * Type) => t.2
9 con thdTTT = fn t :: (Type * Type * Type) => t.3
10
11 con mapTT = fn f :: Type -> Type => fold (fn nm t acc [[nm] ~ acc] =>
12 [nm = f t] ++ acc) []
13
14 con mapUT = fn f :: Type => fold (fn nm t acc [[nm] ~ acc] =>
15 [nm = f] ++ acc) []
16
17 con mapT2T = fn f :: (Type * Type) -> Type => fold (fn nm t acc [[nm] ~ acc] =>
18 [nm = f t] ++ acc) []
19
20 con mapT3T = fn f :: (Type * Type * Type) -> Type => fold (fn nm t acc [[nm] ~ acc] =>
21 [nm = f t] ++ acc) []
22
23 con ex = fn tf :: (Type -> Type) =>
24 res ::: Type -> (choice :: Type -> tf choice -> res) -> res
25
26 val ex : tf :: (Type -> Type) -> choice :: Type -> tf choice -> ex tf
27
28 val compose : t1 ::: Type -> t2 ::: Type -> t3 ::: Type
29 -> (t2 -> t3) -> (t1 -> t2) -> (t1 -> t3)
30
31 val txt : t ::: Type -> ctx ::: {Unit} -> use ::: {Type} -> show t -> t
32 -> xml ctx use []
33
34 val foldUR : tf :: Type -> tr :: ({Unit} -> Type)
35 -> (nm :: Name -> rest :: {Unit}
36 -> fn [[nm] ~ rest] =>
37 tf -> tr rest -> tr ([nm] ++ rest))
38 -> tr [] -> r :: {Unit} -> $(mapUT tf r) -> tr r
39
40 val foldUR2 : tf1 :: Type -> tf2 :: Type -> tr :: ({Unit} -> Type)
41 -> (nm :: Name -> rest :: {Unit}
42 -> fn [[nm] ~ rest] =>
43 tf1 -> tf2 -> tr rest -> tr ([nm] ++ rest))
44 -> tr [] -> r :: {Unit} -> $(mapUT tf1 r) -> $(mapUT tf2 r) -> tr r
45
46 val foldURX2: tf1 :: Type -> tf2 :: Type -> ctx :: {Unit}
47 -> (nm :: Name -> rest :: {Unit}
48 -> fn [[nm] ~ rest] =>
49 tf1 -> tf2 -> xml ctx [] [])
50 -> r :: {Unit} -> $(mapUT tf1 r) -> $(mapUT tf2 r) -> xml ctx [] []
51
52 val foldTR : tf :: (Type -> Type) -> tr :: ({Type} -> Type)
53 -> (nm :: Name -> t :: Type -> rest :: {Type}
54 -> fn [[nm] ~ rest] =>
55 tf t -> tr rest -> tr ([nm = t] ++ rest))
56 -> tr [] -> r :: {Type} -> $(mapTT tf r) -> tr r
57
58 val foldT2R : tf :: ((Type * Type) -> Type) -> tr :: ({(Type * Type)} -> Type)
59 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)}
60 -> fn [[nm] ~ rest] =>
61 tf t -> tr rest -> tr ([nm = t] ++ rest))
62 -> tr [] -> r :: {(Type * Type)} -> $(mapT2T tf r) -> tr r
63
64 val foldT3R : tf :: ((Type * Type * Type) -> Type) -> tr :: ({(Type * Type * Type)} -> Type)
65 -> (nm :: Name -> t :: (Type * Type * Type) -> rest :: {(Type * Type * Type)}
66 -> fn [[nm] ~ rest] =>
67 tf t -> tr rest -> tr ([nm = t] ++ rest))
68 -> tr [] -> r :: {(Type * Type * Type)} -> $(mapT3T tf r) -> tr r
69
70 val foldTR2 : tf1 :: (Type -> Type) -> tf2 :: (Type -> Type)
71 -> tr :: ({Type} -> Type)
72 -> (nm :: Name -> t :: Type -> rest :: {Type}
73 -> fn [[nm] ~ rest] =>
74 tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
75 -> tr []
76 -> r :: {Type} -> $(mapTT tf1 r) -> $(mapTT tf2 r) -> tr r
77
78 val foldT2R2 : tf1 :: ((Type * Type) -> Type) -> tf2 :: ((Type * Type) -> Type)
79 -> tr :: ({(Type * Type)} -> Type)
80 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)}
81 -> fn [[nm] ~ rest] =>
82 tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
83 -> tr [] -> r :: {(Type * Type)}
84 -> $(mapT2T tf1 r) -> $(mapT2T tf2 r) -> tr r
85
86 val foldT3R2 : tf1 :: ((Type * Type * Type) -> Type) -> tf2 :: ((Type * Type * Type) -> Type)
87 -> tr :: ({(Type * Type * Type)} -> Type)
88 -> (nm :: Name -> t :: (Type * Type * Type) -> rest :: {(Type * Type * Type)}
89 -> fn [[nm] ~ rest] =>
90 tf1 t -> tf2 t -> tr rest -> tr ([nm = t] ++ rest))
91 -> tr [] -> r :: {(Type * Type * Type)}
92 -> $(mapT3T tf1 r) -> $(mapT3T tf2 r) -> tr r
93
94 val foldTRX : tf :: (Type -> Type) -> ctx :: {Unit}
95 -> (nm :: Name -> t :: Type -> rest :: {Type}
96 -> fn [[nm] ~ rest] =>
97 tf t -> xml ctx [] [])
98 -> r :: {Type} -> $(mapTT tf r) -> xml ctx [] []
99
100 val foldT2RX : tf :: ((Type * Type) -> Type) -> ctx :: {Unit}
101 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)}
102 -> fn [[nm] ~ rest] =>
103 tf t -> xml ctx [] [])
104 -> r :: {(Type * Type)} -> $(mapT2T tf r) -> xml ctx [] []
105
106 val foldT3RX : tf :: ((Type * Type * Type) -> Type) -> ctx :: {Unit}
107 -> (nm :: Name -> t :: (Type * Type * Type) -> rest :: {(Type * Type * Type)}
108 -> fn [[nm] ~ rest] =>
109 tf t -> xml ctx [] [])
110 -> r :: {(Type * Type * Type)} -> $(mapT3T tf r) -> xml ctx [] []
111
112 val foldTRX2 : tf1 :: (Type -> Type) -> tf2 :: (Type -> Type) -> ctx :: {Unit}
113 -> (nm :: Name -> t :: Type -> rest :: {Type}
114 -> fn [[nm] ~ rest] =>
115 tf1 t -> tf2 t -> xml ctx [] [])
116 -> r :: {Type}
117 -> $(mapTT tf1 r) -> $(mapTT tf2 r) -> xml ctx [] []
118
119 val foldT2RX2 : tf1 :: ((Type * Type) -> Type) -> tf2 :: ((Type * Type) -> Type)
120 -> ctx :: {Unit}
121 -> (nm :: Name -> t :: (Type * Type) -> rest :: {(Type * Type)}
122 -> fn [[nm] ~ rest] =>
123 tf1 t -> tf2 t -> xml ctx [] [])
124 -> r :: {(Type * Type)}
125 -> $(mapT2T tf1 r) -> $(mapT2T tf2 r) -> xml ctx [] []
126
127
128 val foldT3RX2 : tf1 :: ((Type * Type * Type) -> Type) -> tf2 :: ((Type * Type * Type) -> Type)
129 -> ctx :: {Unit}
130 -> (nm :: Name -> t :: (Type * Type * Type) -> rest :: {(Type * Type * Type)}
131 -> fn [[nm] ~ rest] =>
132 tf1 t -> tf2 t -> xml ctx [] [])
133 -> r :: {(Type * Type * Type)}
134 -> $(mapT3T tf1 r) -> $(mapT3T tf2 r) -> xml ctx [] []
135
136 val queryX : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
137 -> sql_query tables exps
138 -> fn [tables ~ exps] =>
139 ($(exps ++ fold (fn nm (fields :: {Type}) acc [[nm] ~ acc] =>
140 [nm = $fields] ++ acc) [] tables)
141 -> xml ctx [] [])
142 -> transaction (xml ctx [] [])
143
144 val queryX' : tables ::: {{Type}} -> exps ::: {Type} -> ctx ::: {Unit}
145 -> sql_query tables exps
146 -> fn [tables ~ exps] =>
147 ($(exps ++ fold (fn nm (fields :: {Type}) acc [[nm] ~ acc] =>
148 [nm = $fields] ++ acc) [] tables)
149 -> transaction (xml ctx [] []))
150 -> transaction (xml ctx [] [])
151
152 val oneOrNoRows : tables ::: {{Type}} -> exps ::: {Type}
153 -> sql_query tables exps
154 -> fn [tables ~ exps] =>
155 transaction
156 (option
157 $(exps
158 ++ fold (fn nm (fields :: {Type}) acc
159 [[nm] ~ acc] =>
160 [nm = $fields] ++ acc)
161 [] tables))
162
163 val oneRow : tables ::: {{Type}} -> exps ::: {Type}
164 -> sql_query tables exps
165 -> fn [tables ~ exps] =>
166 transaction
167 $(exps
168 ++ fold (fn nm (fields :: {Type}) acc
169 [[nm] ~ acc] =>
170 [nm = $fields] ++ acc)
171 [] tables)
172
173 val eqNullable : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type}
174 -> t ::: Type -> sql_injectable (option t)
175 -> sql_exp tables agg exps (option t)
176 -> sql_exp tables agg exps (option t)
177 -> sql_exp tables agg exps bool
178
179 val eqNullable' : tables ::: {{Type}} -> agg ::: {{Type}} -> exps ::: {Type}
180 -> t ::: Type -> sql_injectable (option t)
181 -> sql_exp tables agg exps (option t)
182 -> option t
183 -> sql_exp tables agg exps bool