changeset 388:2e93d18daf44

Monoize eq_[bool|string]
author Adam Chlipala <adamc@hcoop.net>
date Tue, 21 Oct 2008 09:52:52 -0400
parents 7abb28e9d51f
children acaf9d19fbb7
files src/monoize.sml tests/eq.ur
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/monoize.sml	Tue Oct 21 09:50:19 2008 -0400
+++ b/src/monoize.sml	Tue Oct 21 09:52:52 2008 -0400
@@ -530,6 +530,20 @@
                                  (L'.TFfi ("Basis", "bool"), loc),
                                  (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc),
              fm)
+          | L.EFfi ("Basis", "eq_bool") =>
+            ((L'.EAbs ("x", (L'.TFfi ("Basis", "bool"), loc),
+                       (L'.TFun ((L'.TFfi ("Basis", "bool"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
+                       (L'.EAbs ("y", (L'.TFfi ("Basis", "bool"), loc),
+                                 (L'.TFfi ("Basis", "bool"), loc),
+                                 (L'.EBinop ("==", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc),
+             fm)
+          | L.EFfi ("Basis", "eq_string") =>
+            ((L'.EAbs ("x", (L'.TFfi ("Basis", "string"), loc),
+                       (L'.TFun ((L'.TFfi ("Basis", "string"), loc), (L'.TFfi ("Basis", "bool"), loc)), loc),
+                       (L'.EAbs ("y", (L'.TFfi ("Basis", "string"), loc),
+                                 (L'.TFfi ("Basis", "bool"), loc),
+                                 (L'.EBinop ("!strcmp", (L'.ERel 1, loc), (L'.ERel 0, loc)), loc)), loc)), loc),
+             fm)
 
           | L.ECApp ((L.EFfi ("Basis", "show"), _), t) =>
             let
--- a/tests/eq.ur	Tue Oct 21 09:50:19 2008 -0400
+++ b/tests/eq.ur	Tue Oct 21 09:52:52 2008 -0400
@@ -1,4 +1,8 @@
 fun main () : transaction page = return <xml><body>
   {txt _ (1 = 1)}, {txt _ (1 = 2)}<br/>
-  {txt _ (1 <> 1)}, {txt _ (1 <> 2)}
+  {txt _ (1 <> 1)}, {txt _ (1 <> 2)}<br/>
+  {txt _ (True = True)}, {txt _ (True = False)}<br/>
+  {txt _ (True <> True)}, {txt _ (True <> False)}<br/>
+  {txt _ ("A" = "A")}, {txt _ ("A" = "B")}<br/>
+  {txt _ ("A" <> "A")}, {txt _ ("A" <> "B")}<br/>
 </body></xml>