changeset 264:35ed669a253f

Monoize unops
author Adam Chlipala <adamc@hcoop.net>
date Sun, 31 Aug 2008 16:13:07 -0400
parents 02e1870a0516
children b66e692422a4
files src/monoize.sml tests/where.ur
diffstat 2 files changed, 27 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/monoize.sml	Sun Aug 31 16:11:15 2008 -0400
+++ b/src/monoize.sml	Sun Aug 31 16:13:07 2008 -0400
@@ -781,6 +781,32 @@
              (L.ECApp (
               (L.ECApp (
                (L.ECApp (
+                 (L.EFfi ("Basis", "sql_unary"), _),
+                 _), _),
+               _), _),
+              _), _),
+             _), _),
+            _) =>
+            let
+                val s = (L'.TFfi ("Basis", "string"), loc)
+                fun sc s = (L'.EPrim (Prim.String s), loc)
+            in
+                ((L'.EAbs ("c", s, (L'.TFun (s, (L'.TFun (s, s), loc)), loc),
+                           (L'.EAbs ("e1", s, (L'.TFun (s, s), loc),
+                                     strcat loc [sc "(",
+                                                 (L'.ERel 1, loc),
+                                                 sc " ",
+                                                 (L'.ERel 0, loc),
+                                                 sc ")"]), loc)), loc),
+                 fm)
+            end
+          | L.EFfi ("Basis", "sql_not") => ((L'.EPrim (Prim.String "NOT"), loc), fm)
+
+          | L.ECApp (
+            (L.ECApp (
+             (L.ECApp (
+              (L.ECApp (
+               (L.ECApp (
                 (L.ECApp (
                  (L.EFfi ("Basis", "sql_binary"), _),
                  _), _),
--- a/tests/where.ur	Sun Aug 31 16:11:15 2008 -0400
+++ b/tests/where.ur	Sun Aug 31 16:13:07 2008 -0400
@@ -13,7 +13,7 @@
 datatype list a = Nil | Cons of a * list a
 
 val r1 : transaction (list {A : int, B : string, C : float}) =
-        query q8
+        query q7
         (fn fs acc => return (Cons (fs.T1, acc)))
         Nil