diff src/mono_reduce.sml @ 2082:1b76ae703cbb

Some more optimization of string expressions showing up in JSON generation (Meta library)
author Adam Chlipala <adam@chlipala.net>
date Wed, 03 Dec 2014 21:06:15 -0500
parents 04d7d563a36f
children 0d48cfb59b29
line wrap: on
line diff
--- a/src/mono_reduce.sml	Tue Nov 25 08:21:09 2014 -0500
+++ b/src/mono_reduce.sml	Wed Dec 03 21:06:15 2014 -0500
@@ -208,6 +208,20 @@
         else
             No
 
+      | (PPrim (Prim.String (_, s)), _) =>
+        let
+            fun lengthLb (e : exp) =
+                case #1 e of
+                    EStrcat (e1, e2) => lengthLb e1 + lengthLb e2
+                  | EPrim (Prim.String (_, s)) => size s
+                  | _ => 0
+        in
+            if lengthLb e > size s then
+                No
+            else
+                Maybe
+        end
+
       | (PCon (_, PConVar n1, po), ECon (_, PConVar n2, eo)) =>
         if n1 = n2 then
             case (po, eo) of