comparison src/monoize.sml @ 1427:541673c3161d

sql_arith_option; 'ALL' for relational operators
author Adam Chlipala <adam@chlipala.net>
date Fri, 25 Feb 2011 11:27:16 -0500
parents 3dab4696d116
children 607657eb2865
comparison
equal deleted inserted replaced
1426:6365d10cd326 1427:541673c3161d
2569 let 2569 let
2570 val s = (L'.TFfi ("Basis", "string"), loc) 2570 val s = (L'.TFfi ("Basis", "string"), loc)
2571 fun sc s = (L'.EPrim (Prim.String s), loc) 2571 fun sc s = (L'.EPrim (Prim.String s), loc)
2572 in 2572 in
2573 (if #nestedRelops (Settings.currentDbms ()) then 2573 (if #nestedRelops (Settings.currentDbms ()) then
2574 (L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc), 2574 (L'.EAbs ("c", s, (L'.TFun ((L'.TFfi ("Basis", "bool"), loc), (L'.TFun (s, (L'.TFun (s, s), loc)), loc)), loc),
2575 (L'.EAbs ("e1", s, (L'.TFun (s, s), loc), 2575 (L'.EAbs ("all", (L'.TFfi ("Basis", "bool"), loc), (L'.TFun (s, (L'.TFun (s, s), loc)), loc),
2576 (L'.EAbs ("e2", s, s, 2576 (L'.EAbs ("e1", s, (L'.TFun (s, s), loc),
2577 strcat [sc "((", 2577 (L'.EAbs ("e2", s, s,
2578 (L'.ERel 1, loc), 2578 strcat [sc "((",
2579 sc ") ", 2579 (L'.ERel 1, loc),
2580 (L'.ERel 2, loc), 2580 sc ") ",
2581 sc " (", 2581 (L'.ERel 3, loc),
2582 (L'.ERel 0, loc), 2582 (L'.ECase ((L'.ERel 2, loc),
2583 sc "))"]), loc)), loc)), loc) 2583 [((L'.PCon (L'.Enum, L'.PConFfi {mod = "Basis",
2584 datatyp = "bool",
2585 con = "True",
2586 arg = NONE}, NONE), loc),
2587 sc " ALL"),
2588 ((L'.PWild, loc),
2589 sc "")],
2590 {disc = (L'.TFfi ("Basis", "bool"), loc),
2591 result = s}), loc),
2592 sc " (",
2593 (L'.ERel 0, loc),
2594 sc "))"]), loc)), loc)), loc)), loc)
2584 else 2595 else
2585 (L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc), 2596 (L'.EAbs ("c", s, (L'.TFun ((L'.TFfi ("Basis", "bool"), loc), (L'.TFun (s, (L'.TFun (s, s), loc)), loc)), loc),
2586 (L'.EAbs ("e1", s, (L'.TFun (s, s), loc), 2597 (L'.EAbs ("all", (L'.TFfi ("Basis", "bool"), loc), (L'.TFun (s, (L'.TFun (s, s), loc)), loc),
2587 (L'.EAbs ("e2", s, s, 2598 (L'.EAbs ("e1", s, (L'.TFun (s, s), loc),
2588 strcat [(L'.ERel 1, loc), 2599 (L'.EAbs ("e2", s, s,
2589 sc " ", 2600 strcat [(L'.ERel 1, loc),
2590 (L'.ERel 2, loc), 2601 sc " ",
2591 sc " ", 2602 (L'.ERel 3, loc),
2592 (L'.ERel 0, loc)]), loc)), loc)), loc), 2603 (L'.ECase ((L'.ERel 2, loc),
2604 [((L'.PCon (L'.Enum, L'.PConFfi {mod = "Basis",
2605 datatyp = "bool",
2606 con = "True",
2607 arg = NONE}, NONE), loc),
2608 sc " ALL"),
2609 ((L'.PWild, loc),
2610 sc "")],
2611 {disc = (L'.TFfi ("Basis", "bool"), loc),
2612 result = s}), loc),
2613 sc " ",
2614 (L'.ERel 0, loc)]), loc)), loc)), loc)), loc),
2593 fm) 2615 fm)
2594 end 2616 end
2595 | L.ECApp ( 2617 | L.ECApp (
2596 (L.ECApp ( 2618 (L.ECApp (
2597 (L.ECApp ( 2619 (L.ECApp (
2680 (L'.EPrim (Prim.String "SUM"), loc)), loc)), loc), 2702 (L'.EPrim (Prim.String "SUM"), loc)), loc)), loc),
2681 fm) 2703 fm)
2682 2704
2683 | L.EFfi ("Basis", "sql_arith_int") => ((L'.ERecord [], loc), fm) 2705 | L.EFfi ("Basis", "sql_arith_int") => ((L'.ERecord [], loc), fm)
2684 | L.EFfi ("Basis", "sql_arith_float") => ((L'.ERecord [], loc), fm) 2706 | L.EFfi ("Basis", "sql_arith_float") => ((L'.ERecord [], loc), fm)
2707 | L.ECApp ((L.EFfi ("Basis", "sql_arith_option"), _), _) =>
2708 ((L'.EAbs ("_", (L'.TRecord [], loc), (L'.TRecord [], loc),
2709 (L'.ERecord [], loc)), loc),
2710 fm)
2685 2711
2686 | L.EFfi ("Basis", "sql_maxable_int") => ((L'.ERecord [], loc), fm) 2712 | L.EFfi ("Basis", "sql_maxable_int") => ((L'.ERecord [], loc), fm)
2687 | L.EFfi ("Basis", "sql_maxable_float") => ((L'.ERecord [], loc), fm) 2713 | L.EFfi ("Basis", "sql_maxable_float") => ((L'.ERecord [], loc), fm)
2688 | L.EFfi ("Basis", "sql_maxable_string") => ((L'.ERecord [], loc), fm) 2714 | L.EFfi ("Basis", "sql_maxable_string") => ((L'.ERecord [], loc), fm)
2689 | L.ECApp ((L.EFfi ("Basis", "sql_maxable_option"), _), _) => 2715 | L.ECApp ((L.EFfi ("Basis", "sql_maxable_option"), _), _) =>