comparison src/monoize.sml @ 676:e0c186464612

Make sql_injectable class nicer with inclusion
author Adam Chlipala <adamc@hcoop.net>
date Thu, 26 Mar 2009 15:26:35 -0400
parents f73913d97a40
children 5ff1ff38e2db
comparison
equal deleted inserted replaced
675:43430b7190f4 676:e0c186464612
161 | L.CFfi ("Basis", "sql_limit") => 161 | L.CFfi ("Basis", "sql_limit") =>
162 (L'.TFfi ("Basis", "string"), loc) 162 (L'.TFfi ("Basis", "string"), loc)
163 | L.CFfi ("Basis", "sql_offset") => 163 | L.CFfi ("Basis", "sql_offset") =>
164 (L'.TFfi ("Basis", "string"), loc) 164 (L'.TFfi ("Basis", "string"), loc)
165 165
166 | L.CApp ((L.CFfi ("Basis", "sql_injectable_prim"), _), t) =>
167 (L'.TFun (mt env dtmap t, (L'.TFfi ("Basis", "string"), loc)), loc)
166 | L.CApp ((L.CFfi ("Basis", "sql_injectable"), _), t) => 168 | L.CApp ((L.CFfi ("Basis", "sql_injectable"), _), t) =>
167 (L'.TFun (mt env dtmap t, (L'.TFfi ("Basis", "string"), loc)), loc) 169 (L'.TFun (mt env dtmap t, (L'.TFfi ("Basis", "string"), loc)), loc)
168 | L.CApp ((L.CApp ((L.CFfi ("Basis", "sql_unary"), _), _), _), _) => 170 | L.CApp ((L.CApp ((L.CFfi ("Basis", "sql_unary"), _), _), _), _) =>
169 (L'.TFfi ("Basis", "string"), loc) 171 (L'.TFfi ("Basis", "string"), loc)
170 | L.CApp ((L.CApp ((L.CApp ((L.CFfi ("Basis", "sql_binary"), _), _), _), _), _), _) => 172 | L.CApp ((L.CApp ((L.CApp ((L.CFfi ("Basis", "sql_binary"), _), _), _), _), _), _) =>
1421 fm) 1423 fm)
1422 | L.EFfi ("Basis", "sql_time") => 1424 | L.EFfi ("Basis", "sql_time") =>
1423 ((L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "string"), loc), 1425 ((L'.EAbs ("x", (L'.TFfi ("Basis", "time"), loc), (L'.TFfi ("Basis", "string"), loc),
1424 (L'.EFfiApp ("Basis", "sqlifyTime", [(L'.ERel 0, loc)]), loc)), loc), 1426 (L'.EFfiApp ("Basis", "sqlifyTime", [(L'.ERel 0, loc)]), loc)), loc),
1425 fm) 1427 fm)
1426 | L.EFfi ("Basis", "sql_option_int") => 1428 | L.ECApp ((L.EFfi ("Basis", "sql_prim"), _), t) =>
1427 ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "int"), loc), loc), (L'.TFfi ("Basis", "string"), loc), 1429 let
1428 (L'.EFfiApp ("Basis", "sqlifyIntN", [(L'.ERel 0, loc)]), loc)), loc), 1430 val t = monoType env t
1429 fm) 1431 val tf = (L'.TFun (t, (L'.TFfi ("Basis", "string"), loc)), loc)
1430 | L.EFfi ("Basis", "sql_option_float") => 1432 in
1431 ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "float"), loc), loc), (L'.TFfi ("Basis", "string"), loc), 1433 ((L'.EAbs ("f", tf, tf, (L'.ERel 0, loc)), loc),
1432 (L'.EFfiApp ("Basis", "sqlifyFloatN", [(L'.ERel 0, loc)]), loc)), loc), 1434 fm)
1433 fm) 1435 end
1434 | L.EFfi ("Basis", "sql_option_bool") => 1436 | L.ECApp ((L.EFfi ("Basis", "sql_option_prim"), _), t) =>
1435 ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "bool"), loc), loc), (L'.TFfi ("Basis", "string"), loc), 1437 let
1436 (L'.EFfiApp ("Basis", "sqlifyBoolN", [(L'.ERel 0, loc)]), loc)), loc), 1438 val t = monoType env t
1437 fm) 1439 val s = (L'.TFfi ("Basis", "string"), loc)
1438 | L.EFfi ("Basis", "sql_option_string") => 1440 in
1439 ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "string"), loc), loc), (L'.TFfi ("Basis", "string"), loc), 1441 ((L'.EAbs ("f",
1440 (L'.EFfiApp ("Basis", "sqlifyStringN", [(L'.ERel 0, loc)]), loc)), loc), 1442 (L'.TFun (t, s), loc),
1441 fm) 1443 (L'.TFun ((L'.TOption t, loc), s), loc),
1442 | L.EFfi ("Basis", "sql_option_time") => 1444 (L'.EAbs ("x",
1443 ((L'.EAbs ("x", (L'.TOption (L'.TFfi ("Basis", "time"), loc), loc), (L'.TFfi ("Basis", "string"), loc), 1445 (L'.TOption t, loc),
1444 (L'.EFfiApp ("Basis", "sqlifyTimeN", [(L'.ERel 0, loc)]), loc)), loc), 1446 s,
1445 fm) 1447 (L'.ECase ((L'.ERel 0, loc),
1448 [((L'.PNone t, loc),
1449 (L'.EPrim (Prim.String "NULL"), loc)),
1450 ((L'.PSome (t, (L'.PVar ("y", t), loc)), loc),
1451 (L'.EApp ((L'.ERel 2, loc), (L'.ERel 0, loc)), loc))],
1452 {disc = (L'.TOption t, loc),
1453 result = s}), loc)), loc)), loc),
1454 fm)
1455 end
1446 1456
1447 | L.ECApp ((L.EFfi ("Basis", "sql_subset"), _), _) => 1457 | L.ECApp ((L.EFfi ("Basis", "sql_subset"), _), _) =>
1448 ((L'.ERecord [], loc), fm) 1458 ((L'.ERecord [], loc), fm)
1449 | L.ECApp ((L.EFfi ("Basis", "sql_subset_all"), _), _) => 1459 | L.ECApp ((L.EFfi ("Basis", "sql_subset_all"), _), _) =>
1450 ((L'.ERecord [], loc), fm) 1460 ((L'.ERecord [], loc), fm)