diff src/monoize.sml @ 268:bacd0ba869e1

Monoize ASC/DESC
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 16:54:13 -0400
parents f31e8da68e90
children 42dfb0d61cf0
line wrap: on
line diff
--- a/src/monoize.sml	Sun Aug 31 16:32:49 2008 -0400
+++ b/src/monoize.sml	Sun Aug 31 16:54:13 2008 -0400
@@ -718,17 +718,19 @@
                 val s = (L'.TFfi ("Basis", "string"), loc)
                 fun sc s = (L'.EPrim (Prim.String s), loc)
             in
-                ((L'.EAbs ("e1", s, (L'.TFun (s, s), loc),
-                           (L'.EAbs ("e2", s, s,
-                                     (L'.ECase ((L'.ERel 0, loc),
-                                                [((L'.PPrim (Prim.String ""), loc),
-                                                  (L'.ERel 1, loc)),
-                                                 ((L'.PWild, loc),
-                                                  strcat loc [(L'.ERel 1, loc),
-                                                              sc ", ",
-                                                              (L'.ERel 0, loc),
-                                                              sc ")"])],
-                                                {disc = s, result = s}), loc)), loc)), loc),
+                ((L'.EAbs ("e1", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc),
+                           (L'.EAbs ("d", s, (L'.TFun (s, s), loc),
+                                     (L'.EAbs ("e2", s, s,
+                                               (L'.ECase ((L'.ERel 0, loc),
+                                                          [((L'.PPrim (Prim.String ""), loc),
+                                                            strcat loc [(L'.ERel 2, loc),
+                                                                        (L'.ERel 1, loc)]),
+                                                           ((L'.PWild, loc),
+                                                            strcat loc [(L'.ERel 2, loc),
+                                                                        (L'.ERel 1, loc),
+                                                                        sc ", ",
+                                                                        (L'.ERel 0, loc)])],
+                                                          {disc = s, result = s}), loc)), loc)), loc)), loc),
                  fm)
             end
 
@@ -968,6 +970,9 @@
                        (L'.EPrim (Prim.String "MIN"), loc)), loc),
              fm)
 
+          | L.EFfi ("Basis", "sql_asc") => ((L'.EPrim (Prim.String ""), loc), fm)
+          | L.EFfi ("Basis", "sql_desc") => ((L'.EPrim (Prim.String " DESC"), loc), fm)
+
           | L.EApp (
             (L.ECApp (
              (L.ECApp ((L.EFfi ("Basis", "cdata"), _), _), _),