changeset 187:fb6ed259f5bd

Mono_opt for urlifying bools
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 19:01:16 -0400
parents 88d46972de53
children 8e9f97508f0d
files src/mono_opt.sml
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/mono_opt.sml	Sun Aug 03 18:53:20 2008 -0400
+++ b/src/mono_opt.sml	Sun Aug 03 19:01:16 2008 -0400
@@ -185,6 +185,17 @@
       | EWrite (EFfiApp ("Basis", "urlifyString", [e]), _) =>
         EFfiApp ("Basis", "urlifyString_w", [e])
 
+      | EFfiApp ("Basis", "urlifyBool", [(ECon (PConFfi {con = "True", ...}, NONE), _)]) =>
+        EPrim (Prim.String "1")
+      | EFfiApp ("Basis", "urlifyBool", [(ECon (PConFfi {con = "False", ...}, NONE), _)]) =>
+        EPrim (Prim.String "0")
+      | EWrite (EFfiApp ("Basis", "urlifyBool", [(ECon (PConFfi {con = "True", ...}, NONE), _)]), loc) =>
+        EWrite (EPrim (Prim.String "1"), loc)
+      | EWrite (EFfiApp ("Basis", "urlifyBool", [(ECon (PConFfi {con = "False", ...}, NONE), _)]), loc) =>
+        EWrite (EPrim (Prim.String "0"), loc)
+      | EWrite (EFfiApp ("Basis", "urlifyBool", [e]), _) =>
+        EFfiApp ("Basis", "urlifyBool_w", [e])
+
       | EWrite (ECase (discE, pes, {disc, ...}), loc) =>
         optExp (ECase (discE,
                        map (fn (p, e) => (p, (EWrite e, loc))) pes,