From cbebf68dfc1e18c0477d20ea3b424ea2c97c8728 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Tue, 21 Oct 2008 09:52:52 -0400 Subject: Monoize eq_[bool|string] --- src/monoize.sml | 14 ++++++++++++++ tests/eq.ur | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/monoize.sml b/src/monoize.sml index 7428b7fa..21798b0f 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -530,6 +530,20 @@ fun monoExp (env, st, fm) (all as (e, loc)) = (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 diff --git a/tests/eq.ur b/tests/eq.ur index 1a780a57..4f758e0f 100644 --- a/tests/eq.ur +++ b/tests/eq.ur @@ -1,4 +1,8 @@ fun main () : transaction page = return {txt _ (1 = 1)}, {txt _ (1 = 2)}
- {txt _ (1 <> 1)}, {txt _ (1 <> 2)} + {txt _ (1 <> 1)}, {txt _ (1 <> 2)}
+ {txt _ (True = True)}, {txt _ (True = False)}
+ {txt _ (True <> True)}, {txt _ (True <> False)}
+ {txt _ ("A" = "A")}, {txt _ ("A" = "B")}
+ {txt _ ("A" <> "A")}, {txt _ ("A" <> "B")}
-- cgit v1.2.3