summaryrefslogtreecommitdiff
path: root/src/monoize.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-10-06 15:39:27 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-10-06 15:39:27 -0400
commit5765efc372a628ede62d8b27c799708f530a3456 (patch)
treefa80b1891097e60c758ecb12fd8c441f37a03c85 /src/monoize.sml
parent37f1efc23e011927873cfc5871ac7686eac5a745 (diff)
SELECT DISTINCT; eta expansion during Cjrization
Diffstat (limited to 'src/monoize.sml')
-rw-r--r--src/monoize.sml20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index b80b4a65..a01f953f 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -1771,6 +1771,7 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
let
fun sc s = (L'.EPrim (Prim.String s), loc)
val s = (L'.TFfi ("Basis", "string"), loc)
+ val b = (L'.TFfi ("Basis", "bool"), loc)
val un = (L'.TRecord [], loc)
fun gf s = (L'.EField ((L'.ERel 0, loc), s), loc)
@@ -1806,7 +1807,8 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
(fn ((x, _), (y, _)) => String.compare (x, y) = GREATER) sexps
in
((L'.EAbs ("r",
- (L'.TRecord [("From", s),
+ (L'.TRecord [("Distinct", b),
+ ("From", s),
("Where", s),
("GroupBy", un),
("Having", s),
@@ -1815,6 +1817,22 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
loc),
s,
strcat [sc "SELECT ",
+ (L'.ECase (gf "Distinct",
+ [((L'.PCon (L'.Enum,
+ L'.PConFfi {mod = "Basis",
+ datatyp = "bool",
+ con = "True",
+ arg = NONE},
+ NONE), loc),
+ (L'.EPrim (Prim.String "DISTINCT "), loc)),
+ ((L'.PCon (L'.Enum,
+ L'.PConFfi {mod = "Basis",
+ datatyp = "bool",
+ con = "False",
+ arg = NONE},
+ NONE), loc),
+ (L'.EPrim (Prim.String ""), loc))],
+ {disc = b, result = s}), loc),
strcatComma (map (fn (x, t) =>
strcat [
(L'.EField (gf "SelectExps", x), loc),