diff options
author | Adam Chlipala <adamc@hcoop.net> | 2008-10-21 11:22:10 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2008-10-21 11:22:10 -0400 |
commit | c4631a8e9c0b2eb95e99f89357858f771578178a (patch) | |
tree | 319426c4fdbfb8671deb36ca32dfe7172827efdb | |
parent | eaa8b82f581b0b2c59e4867b2f5455084b6b181b (diff) |
ord_string
-rw-r--r-- | src/monoize.sml | 17 | ||||
-rw-r--r-- | tests/ord.ur | 3 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/monoize.sml b/src/monoize.sml index 8ffe3f1b..06156544 100644 --- a/src/monoize.sml +++ b/src/monoize.sml @@ -761,6 +761,23 @@ fun monoExp (env, st, fm) (all as (e, loc)) = boolBin "<", boolBin "<=") end + | L.EFfi ("Basis", "ord_string") => + let + fun boolBin s = + (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 (s, + (L'.EBinop ("strcmp", + (L'.ERel 1, loc), + (L'.ERel 0, loc)), loc), + (L'.EPrim (Prim.Int (Int64.fromInt 0)), loc)), loc)), loc)), loc) + in + ordEx ((L'.TFfi ("Basis", "string"), loc), + boolBin "<", + boolBin "<=") + end | L.ECApp ((L.EFfi ("Basis", "show"), _), t) => let diff --git a/tests/ord.ur b/tests/ord.ur index 52e1c305..fe2dbe8d 100644 --- a/tests/ord.ur +++ b/tests/ord.ur @@ -1,5 +1,6 @@ fun main () : transaction page = return <xml><body> {[ 1 < 1 ]}, {[ 1 < 2 ]}, {[ 1 <= 1 ]}, {[ 2 <= 1 ]}, {[ 1 > 1 ]}, {[ 2 > 1 ]}, {[ 0 >= 1 ]}, {[ 2 >= 1 ]}<br/> {[ 1.0 < 1.0 ]}, {[ 1.0 < 2.0 ]}, {[ 1.0 <= 1.0 ]}, {[ 2.0 <= 1.0 ]}, {[ 1.0 > 1.0 ]}, {[ 2.0 > 1.0 ]}, {[ 0.0 >= 1.0 ]}, {[ 2.0 >= 1.0 ]}<br/> - {[ True < False ]}, {[ False < True ]}, {[ False <= True ]}, {[ False > True ]} + {[ True < False ]}, {[ False < True ]}, {[ False <= True ]}, {[ False > True ]}<br/> + {[ "A" < "B" ]}, {[ "C" < "B" ]} </body></xml> |