Mercurial > urweb
comparison src/mono_opt.sml @ 1663:0577be31a435
First part of changes to avoid depending on C function call argument order of evaluation (omitting normal Ur function calls, so far)
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 07 Jan 2012 15:56:22 -0500 |
parents | 8fce85939259 |
children | 277480862cef |
comparison
equal
deleted
inserted
replaced
1662:edf86cef0dba | 1663:0577be31a435 |
---|---|
136 (false, []) s | 136 (false, []) s |
137 in | 137 in |
138 EPrim (Prim.String (String.implode (rev chs))) | 138 EPrim (Prim.String (String.implode (rev chs))) |
139 end | 139 end |
140 | 140 |
141 | EFfiApp ("Basis", "strcat", [e1, e2]) => exp (EStrcat (e1, e2)) | 141 | EFfiApp ("Basis", "strcat", [(e1, _), (e2, _)]) => exp (EStrcat (e1, e2)) |
142 | 142 |
143 | EStrcat ((EPrim (Prim.String s1), loc), (EPrim (Prim.String s2), _)) => | 143 | EStrcat ((EPrim (Prim.String s1), loc), (EPrim (Prim.String s2), _)) => |
144 let | 144 let |
145 val s = | 145 val s = |
146 if size s1 > 0 andalso size s2 > 0 | 146 if size s1 > 0 andalso size s2 > 0 |
180 (ESeq ((EWrite (EPrim (Prim.String s2), _), _), | 180 (ESeq ((EWrite (EPrim (Prim.String s2), _), _), |
181 e), _)) => | 181 e), _)) => |
182 ESeq ((EWrite (EPrim (Prim.String (s1 ^ s2)), loc), loc), | 182 ESeq ((EWrite (EPrim (Prim.String (s1 ^ s2)), loc), loc), |
183 e) | 183 e) |
184 | 184 |
185 | EFfiApp ("Basis", "htmlifySpecialChar", [(EPrim (Prim.Char ch), _)]) => | 185 | EFfiApp ("Basis", "htmlifySpecialChar", [((EPrim (Prim.Char ch), _), _)]) => |
186 EPrim (Prim.String (htmlifySpecialChar ch)) | 186 EPrim (Prim.String (htmlifySpecialChar ch)) |
187 | EWrite (EFfiApp ("Basis", "htmlifySpecialChar", [e]), _) => | 187 | EWrite (EFfiApp ("Basis", "htmlifySpecialChar", [e]), _) => |
188 EFfiApp ("Basis", "htmlifySpecialChar_w", [e]) | 188 EFfiApp ("Basis", "htmlifySpecialChar_w", [e]) |
189 | 189 |
190 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "intToString", [(EPrim (Prim.Int n), _)]), _)]) => | 190 | EFfiApp ("Basis", "htmlifyString", [((EFfiApp ("Basis", "intToString", [((EPrim (Prim.Int n), _), _)]), _), _)]) => |
191 EPrim (Prim.String (htmlifyInt n)) | 191 EPrim (Prim.String (htmlifyInt n)) |
192 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "intToString", es), _)]) => | 192 | EFfiApp ("Basis", "htmlifyString", [((EFfiApp ("Basis", "intToString", es), _), _)]) => |
193 EFfiApp ("Basis", "htmlifyInt", es) | 193 EFfiApp ("Basis", "htmlifyInt", es) |
194 | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "intToString"), _), | 194 | EFfiApp ("Basis", "htmlifyString", [((EApp ((EFfi ("Basis", "intToString"), _), |
195 (EPrim (Prim.Int n), _)), _)]) => | 195 (EPrim (Prim.Int n), _)), _), _)]) => |
196 EPrim (Prim.String (htmlifyInt n)) | 196 EPrim (Prim.String (htmlifyInt n)) |
197 | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "intToString"), _), | 197 | EFfiApp ("Basis", "htmlifyString", [((EApp ((EFfi ("Basis", "intToString"), _), |
198 e), _)]) => | 198 e), loc), _)]) => |
199 EFfiApp ("Basis", "htmlifyInt", [e]) | 199 EFfiApp ("Basis", "htmlifyInt", [(e, (TFfi ("Basis", "int"), loc))]) |
200 | EWrite (EFfiApp ("Basis", "htmlifyInt", [e]), _) => | 200 | EWrite (EFfiApp ("Basis", "htmlifyInt", [e]), _) => |
201 EFfiApp ("Basis", "htmlifyInt_w", [e]) | 201 EFfiApp ("Basis", "htmlifyInt_w", [e]) |
202 | 202 |
203 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "floatToString", [(EPrim (Prim.Float n), _)]), _)]) => | 203 | EFfiApp ("Basis", "htmlifyString", [((EFfiApp ("Basis", "floatToString", [((EPrim (Prim.Float n), _), _)]), _), _)]) => |
204 EPrim (Prim.String (htmlifyFloat n)) | 204 EPrim (Prim.String (htmlifyFloat n)) |
205 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "floatToString", es), _)]) => | 205 | EFfiApp ("Basis", "htmlifyString", [((EFfiApp ("Basis", "floatToString", es), _), _)]) => |
206 EFfiApp ("Basis", "htmlifyFloat", es) | 206 EFfiApp ("Basis", "htmlifyFloat", es) |
207 | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "floatToString"), _), | 207 | EFfiApp ("Basis", "htmlifyString", [((EApp ((EFfi ("Basis", "floatToString"), _), |
208 (EPrim (Prim.Float n), _)), _)]) => | 208 (EPrim (Prim.Float n), _)), _), _)]) => |
209 EPrim (Prim.String (htmlifyFloat n)) | 209 EPrim (Prim.String (htmlifyFloat n)) |
210 | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "floatToString"), _), | 210 | EFfiApp ("Basis", "htmlifyString", [((EApp ((EFfi ("Basis", "floatToString"), _), |
211 e), _)]) => | 211 e), loc), _)]) => |
212 EFfiApp ("Basis", "htmlifyFloat", [e]) | 212 EFfiApp ("Basis", "htmlifyFloat", [(e, (TFfi ("Basis", "float"), loc))]) |
213 | EWrite (EFfiApp ("Basis", "htmlifyFloat", [e]), _) => | 213 | EWrite (EFfiApp ("Basis", "htmlifyFloat", [e]), _) => |
214 EFfiApp ("Basis", "htmlifyFloat_w", [e]) | 214 EFfiApp ("Basis", "htmlifyFloat_w", [e]) |
215 | 215 |
216 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "boolToString", | 216 | EFfiApp ("Basis", "htmlifyString", [((EFfiApp ("Basis", "boolToString", |
217 [(ECon (Enum, PConFfi {con = "True", ...}, NONE), _)]), _)]) => | 217 [((ECon (Enum, PConFfi {con = "True", ...}, NONE), _), _)]), _), _)]) => |
218 EPrim (Prim.String "True") | 218 EPrim (Prim.String "True") |
219 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "boolToString", | 219 | EFfiApp ("Basis", "htmlifyString", [((EFfiApp ("Basis", "boolToString", |
220 [(ECon (Enum, PConFfi {con = "False", ...}, NONE), _)]), _)]) => | 220 [((ECon (Enum, PConFfi {con = "False", ...}, NONE), _), _)]), _), _)]) => |
221 EPrim (Prim.String "False") | 221 EPrim (Prim.String "False") |
222 | EFfiApp ("Basis", "htmlifyString", [(EFfiApp ("Basis", "boolToString", es), _)]) => | 222 | EFfiApp ("Basis", "htmlifyString", [((EFfiApp ("Basis", "boolToString", es), _), _)]) => |
223 EFfiApp ("Basis", "htmlifyBool", es) | 223 EFfiApp ("Basis", "htmlifyBool", es) |
224 | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "boolToString"), _), | 224 | EFfiApp ("Basis", "htmlifyString", [((EApp ((EFfi ("Basis", "boolToString"), _), |
225 (ECon (Enum, PConFfi {con = "True", ...}, NONE), _)), _)]) => | 225 (ECon (Enum, PConFfi {con = "True", ...}, NONE), _)), _), _)]) => |
226 EPrim (Prim.String "True") | 226 EPrim (Prim.String "True") |
227 | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "boolToString"), _), | 227 | EFfiApp ("Basis", "htmlifyString", [((EApp ((EFfi ("Basis", "boolToString"), _), |
228 (ECon (Enum, PConFfi {con = "False", ...}, NONE), _)), _)]) => | 228 (ECon (Enum, PConFfi {con = "False", ...}, NONE), _)), _), _)]) => |
229 EPrim (Prim.String "False") | 229 EPrim (Prim.String "False") |
230 | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "boolToString"), _), | 230 | EFfiApp ("Basis", "htmlifyString", [((EApp ((EFfi ("Basis", "boolToString"), _), |
231 e), _)]) => | 231 e), loc), _)]) => |
232 EFfiApp ("Basis", "htmlifyBool", [e]) | 232 EFfiApp ("Basis", "htmlifyBool", [(e, (TFfi ("Basis", "bool"), loc))]) |
233 | EWrite (EFfiApp ("Basis", "htmlifyBool", [e]), _) => | 233 | EWrite (EFfiApp ("Basis", "htmlifyBool", [e]), _) => |
234 EFfiApp ("Basis", "htmlifyBool_w", [e]) | 234 EFfiApp ("Basis", "htmlifyBool_w", [e]) |
235 | 235 |
236 | EFfiApp ("Basis", "htmlifyString", [(EApp ((EFfi ("Basis", "timeToString"), _), e), _)]) => | 236 | EFfiApp ("Basis", "htmlifyString", [((EApp ((EFfi ("Basis", "timeToString"), _), e), loc), _)]) => |
237 EFfiApp ("Basis", "htmlifyTime", [e]) | 237 EFfiApp ("Basis", "htmlifyTime", [(e, (TFfi ("Basis", "time"), loc))]) |
238 | EFfiApp ("Basis", "htmlifyString_w", [(EApp ((EFfi ("Basis", "timeToString"), _), e), _)]) => | 238 | EFfiApp ("Basis", "htmlifyString_w", [((EApp ((EFfi ("Basis", "timeToString"), loc), e), _), _)]) => |
239 EFfiApp ("Basis", "htmlifyTime_w", [e]) | 239 EFfiApp ("Basis", "htmlifyTime_w", [(e, (TFfi ("Basis", "time"), loc))]) |
240 | EWrite (EFfiApp ("Basis", "htmlifyTime", [e]), _) => | 240 | EWrite (EFfiApp ("Basis", "htmlifyTime", [e]), _) => |
241 EFfiApp ("Basis", "htmlifyTime_w", [e]) | 241 EFfiApp ("Basis", "htmlifyTime_w", [e]) |
242 | 242 |
243 | EFfiApp ("Basis", "htmlifyString", [(EPrim (Prim.String s), _)]) => | 243 | EFfiApp ("Basis", "htmlifyString", [((EPrim (Prim.String s), _), _)]) => |
244 EPrim (Prim.String (htmlifyString s)) | 244 EPrim (Prim.String (htmlifyString s)) |
245 | EWrite (EFfiApp ("Basis", "htmlifyString", [(EPrim (Prim.String s), _)]), loc) => | 245 | EWrite (EFfiApp ("Basis", "htmlifyString", [((EPrim (Prim.String s), _), _)]), loc) => |
246 EWrite (EPrim (Prim.String (htmlifyString s)), loc) | 246 EWrite (EPrim (Prim.String (htmlifyString s)), loc) |
247 | EWrite (EFfiApp ("Basis", "htmlifyString", [e]), _) => | 247 | EWrite (EFfiApp ("Basis", "htmlifyString", [e]), _) => |
248 EFfiApp ("Basis", "htmlifyString_w", [e]) | 248 EFfiApp ("Basis", "htmlifyString_w", [e]) |
249 | EFfiApp ("Basis", "htmlifyString_w", [(EPrim (Prim.String s), loc)]) => | 249 | EFfiApp ("Basis", "htmlifyString_w", [((EPrim (Prim.String s), loc), _)]) => |
250 EWrite (EPrim (Prim.String (htmlifyString s)), loc) | 250 EWrite (EPrim (Prim.String (htmlifyString s)), loc) |
251 | 251 |
252 | EWrite (EFfiApp ("Basis", "htmlifySource", [e]), _) => | 252 | EWrite (EFfiApp ("Basis", "htmlifySource", [e]), _) => |
253 EFfiApp ("Basis", "htmlifySource_w", [e]) | 253 EFfiApp ("Basis", "htmlifySource_w", [e]) |
254 | 254 |
255 | EFfiApp ("Basis", "attrifyInt", [(EPrim (Prim.Int n), _)]) => | 255 | EFfiApp ("Basis", "attrifyInt", [((EPrim (Prim.Int n), _), _)]) => |
256 EPrim (Prim.String (attrifyInt n)) | 256 EPrim (Prim.String (attrifyInt n)) |
257 | EWrite (EFfiApp ("Basis", "attrifyInt", [(EPrim (Prim.Int n), _)]), loc) => | 257 | EWrite (EFfiApp ("Basis", "attrifyInt", [((EPrim (Prim.Int n), _), _)]), loc) => |
258 EWrite (EPrim (Prim.String (attrifyInt n)), loc) | 258 EWrite (EPrim (Prim.String (attrifyInt n)), loc) |
259 | EWrite (EFfiApp ("Basis", "attrifyInt", [e]), _) => | 259 | EWrite (EFfiApp ("Basis", "attrifyInt", [e]), _) => |
260 EFfiApp ("Basis", "attrifyInt_w", [e]) | 260 EFfiApp ("Basis", "attrifyInt_w", [e]) |
261 | 261 |
262 | EFfiApp ("Basis", "attrifyFloat", [(EPrim (Prim.Float n), _)]) => | 262 | EFfiApp ("Basis", "attrifyFloat", [((EPrim (Prim.Float n), _), _)]) => |
263 EPrim (Prim.String (attrifyFloat n)) | 263 EPrim (Prim.String (attrifyFloat n)) |
264 | EWrite (EFfiApp ("Basis", "attrifyFloat", [(EPrim (Prim.Float n), _)]), loc) => | 264 | EWrite (EFfiApp ("Basis", "attrifyFloat", [((EPrim (Prim.Float n), _), _)]), loc) => |
265 EWrite (EPrim (Prim.String (attrifyFloat n)), loc) | 265 EWrite (EPrim (Prim.String (attrifyFloat n)), loc) |
266 | EWrite (EFfiApp ("Basis", "attrifyFloat", [e]), _) => | 266 | EWrite (EFfiApp ("Basis", "attrifyFloat", [e]), _) => |
267 EFfiApp ("Basis", "attrifyFloat_w", [e]) | 267 EFfiApp ("Basis", "attrifyFloat_w", [e]) |
268 | 268 |
269 | EFfiApp ("Basis", "attrifyString", [(EPrim (Prim.String s), _)]) => | 269 | EFfiApp ("Basis", "attrifyString", [((EPrim (Prim.String s), _), _)]) => |
270 EPrim (Prim.String (attrifyString s)) | 270 EPrim (Prim.String (attrifyString s)) |
271 | EWrite (EFfiApp ("Basis", "attrifyString", [(EPrim (Prim.String s), _)]), loc) => | 271 | EWrite (EFfiApp ("Basis", "attrifyString", [((EPrim (Prim.String s), _), _)]), loc) => |
272 EWrite (EPrim (Prim.String (attrifyString s)), loc) | 272 EWrite (EPrim (Prim.String (attrifyString s)), loc) |
273 | EWrite (EFfiApp ("Basis", "attrifyString", [e]), _) => | 273 | EWrite (EFfiApp ("Basis", "attrifyString", [e]), _) => |
274 EFfiApp ("Basis", "attrifyString_w", [e]) | 274 EFfiApp ("Basis", "attrifyString_w", [e]) |
275 | 275 |
276 | EFfiApp ("Basis", "attrifyChar", [(EPrim (Prim.Char s), _)]) => | 276 | EFfiApp ("Basis", "attrifyChar", [((EPrim (Prim.Char s), _), _)]) => |
277 EPrim (Prim.String (attrifyChar s)) | 277 EPrim (Prim.String (attrifyChar s)) |
278 | EWrite (EFfiApp ("Basis", "attrifyChar", [(EPrim (Prim.Char s), _)]), loc) => | 278 | EWrite (EFfiApp ("Basis", "attrifyChar", [((EPrim (Prim.Char s), _), _)]), loc) => |
279 EWrite (EPrim (Prim.String (attrifyChar s)), loc) | 279 EWrite (EPrim (Prim.String (attrifyChar s)), loc) |
280 | EWrite (EFfiApp ("Basis", "attrifyChar", [e]), _) => | 280 | EWrite (EFfiApp ("Basis", "attrifyChar", [e]), _) => |
281 EFfiApp ("Basis", "attrifyChar_w", [e]) | 281 EFfiApp ("Basis", "attrifyChar_w", [e]) |
282 | 282 |
283 | EFfiApp ("Basis", "attrifyCss_class", [(EPrim (Prim.String s), _)]) => | 283 | EFfiApp ("Basis", "attrifyCss_class", [((EPrim (Prim.String s), _), _)]) => |
284 EPrim (Prim.String s) | 284 EPrim (Prim.String s) |
285 | EWrite (EFfiApp ("Basis", "attrifyCss_class", [(EPrim (Prim.String s), _)]), loc) => | 285 | EWrite (EFfiApp ("Basis", "attrifyCss_class", [((EPrim (Prim.String s), _), _)]), loc) => |
286 EWrite (EPrim (Prim.String s), loc) | 286 EWrite (EPrim (Prim.String s), loc) |
287 | EWrite (EFfiApp ("Basis", "attrifyCss_class", [e]), _) => | 287 | EWrite (EFfiApp ("Basis", "attrifyCss_class", [e]), _) => |
288 EFfiApp ("Basis", "attrifyString_w", [e]) | 288 EFfiApp ("Basis", "attrifyString_w", [e]) |
289 | 289 |
290 | EFfiApp ("Basis", "urlifyInt", [(EPrim (Prim.Int n), _)]) => | 290 | EFfiApp ("Basis", "urlifyInt", [((EPrim (Prim.Int n), _), _)]) => |
291 EPrim (Prim.String (urlifyInt n)) | 291 EPrim (Prim.String (urlifyInt n)) |
292 | EWrite (EFfiApp ("Basis", "urlifyInt", [(EPrim (Prim.Int n), _)]), loc) => | 292 | EWrite (EFfiApp ("Basis", "urlifyInt", [((EPrim (Prim.Int n), _), _)]), loc) => |
293 EWrite (EPrim (Prim.String (urlifyInt n)), loc) | 293 EWrite (EPrim (Prim.String (urlifyInt n)), loc) |
294 | EWrite (EFfiApp ("Basis", "urlifyInt", [e]), _) => | 294 | EWrite (EFfiApp ("Basis", "urlifyInt", [e]), _) => |
295 EFfiApp ("Basis", "urlifyInt_w", [e]) | 295 EFfiApp ("Basis", "urlifyInt_w", [e]) |
296 | 296 |
297 | EFfiApp ("Basis", "urlifyFloat", [(EPrim (Prim.Float n), _)]) => | 297 | EFfiApp ("Basis", "urlifyFloat", [((EPrim (Prim.Float n), _), _)]) => |
298 EPrim (Prim.String (urlifyFloat n)) | 298 EPrim (Prim.String (urlifyFloat n)) |
299 | EWrite (EFfiApp ("Basis", "urlifyFloat", [(EPrim (Prim.Float n), _)]), loc) => | 299 | EWrite (EFfiApp ("Basis", "urlifyFloat", [((EPrim (Prim.Float n), _), _)]), loc) => |
300 EWrite (EPrim (Prim.String (urlifyFloat n)), loc) | 300 EWrite (EPrim (Prim.String (urlifyFloat n)), loc) |
301 | EWrite (EFfiApp ("Basis", "urlifyFloat", [e]), _) => | 301 | EWrite (EFfiApp ("Basis", "urlifyFloat", [e]), _) => |
302 EFfiApp ("Basis", "urlifyFloat_w", [e]) | 302 EFfiApp ("Basis", "urlifyFloat_w", [e]) |
303 | 303 |
304 | EFfiApp ("Basis", "urlifyString", [(EPrim (Prim.String s), _)]) => | 304 | EFfiApp ("Basis", "urlifyString", [((EPrim (Prim.String s), _), _)]) => |
305 EPrim (Prim.String (urlifyString s)) | 305 EPrim (Prim.String (urlifyString s)) |
306 | EWrite (EFfiApp ("Basis", "urlifyString", [(EPrim (Prim.String s), _)]), loc) => | 306 | EWrite (EFfiApp ("Basis", "urlifyString", [((EPrim (Prim.String s), _), _)]), loc) => |
307 EWrite (EPrim (Prim.String (urlifyString s)), loc) | 307 EWrite (EPrim (Prim.String (urlifyString s)), loc) |
308 | EWrite (EFfiApp ("Basis", "urlifyString", [e]), _) => | 308 | EWrite (EFfiApp ("Basis", "urlifyString", [e]), _) => |
309 EFfiApp ("Basis", "urlifyString_w", [e]) | 309 EFfiApp ("Basis", "urlifyString_w", [e]) |
310 | 310 |
311 | EFfiApp ("Basis", "urlifyBool", [(ECon (Enum, PConFfi {con = "True", ...}, NONE), _)]) => | 311 | EFfiApp ("Basis", "urlifyBool", [((ECon (Enum, PConFfi {con = "True", ...}, NONE), _), _)]) => |
312 EPrim (Prim.String "1") | 312 EPrim (Prim.String "1") |
313 | EFfiApp ("Basis", "urlifyBool", [(ECon (Enum, PConFfi {con = "False", ...}, NONE), _)]) => | 313 | EFfiApp ("Basis", "urlifyBool", [((ECon (Enum, PConFfi {con = "False", ...}, NONE), _), _)]) => |
314 EPrim (Prim.String "0") | 314 EPrim (Prim.String "0") |
315 | EWrite (EFfiApp ("Basis", "urlifyBool", [(ECon (Enum, PConFfi {con = "True", ...}, NONE), _)]), loc) => | 315 | EWrite (EFfiApp ("Basis", "urlifyBool", [((ECon (Enum, PConFfi {con = "True", ...}, NONE), _), _)]), loc) => |
316 EWrite (EPrim (Prim.String "1"), loc) | 316 EWrite (EPrim (Prim.String "1"), loc) |
317 | EWrite (EFfiApp ("Basis", "urlifyBool", [(ECon (Enum, PConFfi {con = "False", ...}, NONE), _)]), loc) => | 317 | EWrite (EFfiApp ("Basis", "urlifyBool", [((ECon (Enum, PConFfi {con = "False", ...}, NONE), _), _)]), loc) => |
318 EWrite (EPrim (Prim.String "0"), loc) | 318 EWrite (EPrim (Prim.String "0"), loc) |
319 | EWrite (EFfiApp ("Basis", "urlifyBool", [e]), _) => | 319 | EWrite (EFfiApp ("Basis", "urlifyBool", [e]), _) => |
320 EFfiApp ("Basis", "urlifyBool_w", [e]) | 320 EFfiApp ("Basis", "urlifyBool_w", [e]) |
321 | 321 |
322 | EFfiApp ("Basis", "sqlifyInt", [(EPrim (Prim.Int n), _)]) => | 322 | EFfiApp ("Basis", "sqlifyInt", [((EPrim (Prim.Int n), _), _)]) => |
323 EPrim (Prim.String (sqlifyInt n)) | 323 EPrim (Prim.String (sqlifyInt n)) |
324 | EFfiApp ("Basis", "sqlifyIntN", [(ENone _, _)]) => | 324 | EFfiApp ("Basis", "sqlifyIntN", [((ENone _, _), _)]) => |
325 EPrim (Prim.String "NULL") | 325 EPrim (Prim.String "NULL") |
326 | EFfiApp ("Basis", "sqlifyIntN", [(ESome (_, (EPrim (Prim.Int n), _)), _)]) => | 326 | EFfiApp ("Basis", "sqlifyIntN", [((ESome (_, (EPrim (Prim.Int n), _)), _), _)]) => |
327 EPrim (Prim.String (sqlifyInt n)) | 327 EPrim (Prim.String (sqlifyInt n)) |
328 | 328 |
329 | EFfiApp ("Basis", "sqlifyFloat", [(EPrim (Prim.Float n), _)]) => | 329 | EFfiApp ("Basis", "sqlifyFloat", [((EPrim (Prim.Float n), _), _)]) => |
330 EPrim (Prim.String (sqlifyFloat n)) | 330 EPrim (Prim.String (sqlifyFloat n)) |
331 | EFfiApp ("Basis", "sqlifyBool", [b as (_, loc)]) => | 331 | EFfiApp ("Basis", "sqlifyBool", [(b as (_, loc), _)]) => |
332 optExp (ECase (b, | 332 optExp (ECase (b, |
333 [((PCon (Enum, PConFfi {mod = "Basis", datatyp = "bool", con = "True", arg = NONE}, NONE), loc), | 333 [((PCon (Enum, PConFfi {mod = "Basis", datatyp = "bool", con = "True", arg = NONE}, NONE), loc), |
334 (EPrim (Prim.String (#trueString (Settings.currentDbms ()))), loc)), | 334 (EPrim (Prim.String (#trueString (Settings.currentDbms ()))), loc)), |
335 ((PCon (Enum, PConFfi {mod = "Basis", datatyp = "bool", con = "False", arg = NONE}, NONE), loc), | 335 ((PCon (Enum, PConFfi {mod = "Basis", datatyp = "bool", con = "False", arg = NONE}, NONE), loc), |
336 (EPrim (Prim.String (#falseString (Settings.currentDbms ()))), loc))], | 336 (EPrim (Prim.String (#falseString (Settings.currentDbms ()))), loc))], |
337 {disc = (TFfi ("Basis", "bool"), loc), | 337 {disc = (TFfi ("Basis", "bool"), loc), |
338 result = (TFfi ("Basis", "string"), loc)}), loc) | 338 result = (TFfi ("Basis", "string"), loc)}), loc) |
339 | EFfiApp ("Basis", "sqlifyString", [(EPrim (Prim.String n), _)]) => | 339 | EFfiApp ("Basis", "sqlifyString", [((EPrim (Prim.String n), _), _)]) => |
340 EPrim (Prim.String (sqlifyString n)) | 340 EPrim (Prim.String (sqlifyString n)) |
341 | EFfiApp ("Basis", "sqlifyChar", [(EPrim (Prim.Char n), _)]) => | 341 | EFfiApp ("Basis", "sqlifyChar", [((EPrim (Prim.Char n), _), _)]) => |
342 EPrim (Prim.String (sqlifyChar n)) | 342 EPrim (Prim.String (sqlifyChar n)) |
343 | 343 |
344 | EWrite (ECase (discE, pes, {disc, ...}), loc) => | 344 | EWrite (ECase (discE, pes, {disc, ...}), loc) => |
345 optExp (ECase (discE, | 345 optExp (ECase (discE, |
346 map (fn (p, e) => (p, (EWrite e, loc))) pes, | 346 map (fn (p, e) => (p, (EWrite e, loc))) pes, |
416 ERecord [] | 416 ERecord [] |
417 | 417 |
418 | ESignalBind ((ESignalReturn e1, loc), e2) => | 418 | ESignalBind ((ESignalReturn e1, loc), e2) => |
419 optExp (EApp (e2, e1), loc) | 419 optExp (EApp (e2, e1), loc) |
420 | 420 |
421 | EFfiApp ("Basis", "bless", [(se as EPrim (Prim.String s), loc)]) => | 421 | EFfiApp ("Basis", "bless", [((se as EPrim (Prim.String s), loc), _)]) => |
422 (if checkUrl s then | 422 (if checkUrl s then |
423 () | 423 () |
424 else | 424 else |
425 ErrorMsg.errorAt loc ("Invalid URL " ^ s ^ " passed to 'bless'"); | 425 ErrorMsg.errorAt loc ("Invalid URL " ^ s ^ " passed to 'bless'"); |
426 se) | 426 se) |
427 | EFfiApp ("Basis", "checkUrl", [(se as EPrim (Prim.String s), loc)]) => | 427 | EFfiApp ("Basis", "checkUrl", [((se as EPrim (Prim.String s), loc), _)]) => |
428 (if checkUrl s then | 428 (if checkUrl s then |
429 ESome ((TFfi ("Basis", "string"), loc), (se, loc)) | 429 ESome ((TFfi ("Basis", "string"), loc), (se, loc)) |
430 else | 430 else |
431 ENone (TFfi ("Basis", "string"), loc)) | 431 ENone (TFfi ("Basis", "string"), loc)) |
432 | EFfiApp ("Basis", "blessMime", [(se as EPrim (Prim.String s), loc)]) => | 432 | EFfiApp ("Basis", "blessMime", [((se as EPrim (Prim.String s), loc), _)]) => |
433 (if Settings.checkMime s then | 433 (if Settings.checkMime s then |
434 () | 434 () |
435 else | 435 else |
436 ErrorMsg.errorAt loc ("Invalid string " ^ s ^ " passed to 'blessMime'"); | 436 ErrorMsg.errorAt loc ("Invalid string " ^ s ^ " passed to 'blessMime'"); |
437 se) | 437 se) |
438 | EFfiApp ("Basis", "checkMime", [(se as EPrim (Prim.String s), loc)]) => | 438 | EFfiApp ("Basis", "checkMime", [((se as EPrim (Prim.String s), loc), _)]) => |
439 (if Settings.checkMime s then | 439 (if Settings.checkMime s then |
440 ESome ((TFfi ("Basis", "string"), loc), (se, loc)) | 440 ESome ((TFfi ("Basis", "string"), loc), (se, loc)) |
441 else | 441 else |
442 ENone (TFfi ("Basis", "string"), loc)) | 442 ENone (TFfi ("Basis", "string"), loc)) |
443 | EFfiApp ("Basis", "blessRequestHeader", [(se as EPrim (Prim.String s), loc)]) => | 443 | EFfiApp ("Basis", "blessRequestHeader", [((se as EPrim (Prim.String s), loc), _)]) => |
444 (if Settings.checkRequestHeader s then | 444 (if Settings.checkRequestHeader s then |
445 () | 445 () |
446 else | 446 else |
447 ErrorMsg.errorAt loc ("Invalid string " ^ s ^ " passed to 'blessRequestHeader'"); | 447 ErrorMsg.errorAt loc ("Invalid string " ^ s ^ " passed to 'blessRequestHeader'"); |
448 se) | 448 se) |
449 | EFfiApp ("Basis", "checkRequestHeader", [(se as EPrim (Prim.String s), loc)]) => | 449 | EFfiApp ("Basis", "checkRequestHeader", [((se as EPrim (Prim.String s), loc), _)]) => |
450 (if Settings.checkRequestHeader s then | 450 (if Settings.checkRequestHeader s then |
451 ESome ((TFfi ("Basis", "string"), loc), (se, loc)) | 451 ESome ((TFfi ("Basis", "string"), loc), (se, loc)) |
452 else | 452 else |
453 ENone (TFfi ("Basis", "string"), loc)) | 453 ENone (TFfi ("Basis", "string"), loc)) |
454 | EFfiApp ("Basis", "blessResponseHeader", [(se as EPrim (Prim.String s), loc)]) => | 454 | EFfiApp ("Basis", "blessResponseHeader", [((se as EPrim (Prim.String s), loc), _)]) => |
455 (if Settings.checkResponseHeader s then | 455 (if Settings.checkResponseHeader s then |
456 () | 456 () |
457 else | 457 else |
458 ErrorMsg.errorAt loc ("Invalid string " ^ s ^ " passed to 'blessResponseHeader'"); | 458 ErrorMsg.errorAt loc ("Invalid string " ^ s ^ " passed to 'blessResponseHeader'"); |
459 se) | 459 se) |
460 | EFfiApp ("Basis", "checkResponseHeader", [(se as EPrim (Prim.String s), loc)]) => | 460 | EFfiApp ("Basis", "checkResponseHeader", [((se as EPrim (Prim.String s), loc), _)]) => |
461 (if Settings.checkResponseHeader s then | 461 (if Settings.checkResponseHeader s then |
462 ESome ((TFfi ("Basis", "string"), loc), (se, loc)) | 462 ESome ((TFfi ("Basis", "string"), loc), (se, loc)) |
463 else | 463 else |
464 ENone (TFfi ("Basis", "string"), loc)) | 464 ENone (TFfi ("Basis", "string"), loc)) |
465 | 465 |
466 | EFfiApp ("Basis", "checkString", [(EPrim (Prim.String s), loc)]) => | 466 | EFfiApp ("Basis", "checkString", [((EPrim (Prim.String s), loc), _)]) => |
467 let | 467 let |
468 fun uwify (cs, acc) = | 468 fun uwify (cs, acc) = |
469 case cs of | 469 case cs of |
470 [] => String.concat (rev acc) | 470 [] => String.concat (rev acc) |
471 | #"(" :: #"_" :: cs => uwify (cs, "(uw_" :: acc) | 471 | #"(" :: #"_" :: cs => uwify (cs, "(uw_" :: acc) |
489 | cs => uwify (cs, []) | 489 | cs => uwify (cs, []) |
490 in | 490 in |
491 EPrim (Prim.String s) | 491 EPrim (Prim.String s) |
492 end | 492 end |
493 | 493 |
494 | EFfiApp ("Basis", "viewify", [(EPrim (Prim.String s), loc)]) => | 494 | EFfiApp ("Basis", "viewify", [((EPrim (Prim.String s), loc), _)]) => |
495 let | 495 let |
496 fun uwify (cs, acc) = | 496 fun uwify (cs, acc) = |
497 case cs of | 497 case cs of |
498 [] => String.concat (rev acc) | 498 [] => String.concat (rev acc) |
499 | #"A" :: #"S" :: #" " :: #"_" :: cs => uwify (cs, "AS uw_" :: acc) | 499 | #"A" :: #"S" :: #" " :: #"_" :: cs => uwify (cs, "AS uw_" :: acc) |
514 val s = uwify (String.explode s, []) | 514 val s = uwify (String.explode s, []) |
515 in | 515 in |
516 EPrim (Prim.String s) | 516 EPrim (Prim.String s) |
517 end | 517 end |
518 | 518 |
519 | EFfiApp ("Basis", "unAs", [(EPrim (Prim.String s), _)]) => | 519 | EFfiApp ("Basis", "unAs", [((EPrim (Prim.String s), _), _)]) => |
520 EPrim (Prim.String (unAs s)) | 520 EPrim (Prim.String (unAs s)) |
521 | EFfiApp ("Basis", "unAs", [e']) => | 521 | EFfiApp ("Basis", "unAs", [(e', _)]) => |
522 let | 522 let |
523 fun parts (e as (_, loc)) = | 523 fun parts (e as (_, loc)) = |
524 case #1 e of | 524 case #1 e of |
525 EStrcat (s1, s2) => | 525 EStrcat (s1, s2) => |
526 (case (parts s1, parts s2) of | 526 (case (parts s1, parts s2) of |
541 (e as (_, loc)) :: es => #1 (foldl (fn (e, es) => (EStrcat (e, es), loc)) e es) | 541 (e as (_, loc)) :: es => #1 (foldl (fn (e, es) => (EStrcat (e, es), loc)) e es) |
542 | [] => raise Fail "MonoOpt impossible nil") | 542 | [] => raise Fail "MonoOpt impossible nil") |
543 | NONE => e | 543 | NONE => e |
544 end | 544 end |
545 | 545 |
546 | EFfiApp ("Basis", "str1", [(EPrim (Prim.Char ch), _)]) => | 546 | EFfiApp ("Basis", "str1", [((EPrim (Prim.Char ch), _), _)]) => |
547 EPrim (Prim.String (str ch)) | 547 EPrim (Prim.String (str ch)) |
548 | EFfiApp ("Basis", "attrifyString", [(EFfiApp ("Basis", "str1", [e]), _)]) => | 548 | EFfiApp ("Basis", "attrifyString", [((EFfiApp ("Basis", "str1", [e]), _), _)]) => |
549 EFfiApp ("Basis", "attrifyChar", [e]) | 549 EFfiApp ("Basis", "attrifyChar", [e]) |
550 | EFfiApp ("Basis", "attrifyString_w", [(EFfiApp ("Basis", "str1", [e]), _)]) => | 550 | EFfiApp ("Basis", "attrifyString_w", [((EFfiApp ("Basis", "str1", [e]), _), _)]) => |
551 EFfiApp ("Basis", "attrifyChar_w", [e]) | 551 EFfiApp ("Basis", "attrifyChar_w", [e]) |
552 | 552 |
553 | EBinop (_, "+", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.+ (n1, n2))) | 553 | EBinop (_, "+", (EPrim (Prim.Int n1), _), (EPrim (Prim.Int n2), _)) => EPrim (Prim.Int (Int64.+ (n1, n2))) |
554 | 554 |
555 | _ => e | 555 | _ => e |