diff options
author | Adam Chlipala <adam@chlipala.net> | 2014-12-03 21:06:15 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2014-12-03 21:06:15 -0500 |
commit | c881c3b462801bc67419783c4169302fce5e3aeb (patch) | |
tree | f6fa67ac04d64173f412ca0b28f2257a03167463 /src/mono_reduce.sml | |
parent | b2b29ea1e208836b21842ce2126fb9fd8521247e (diff) |
Some more optimization of string expressions showing up in JSON generation (Meta library)
Diffstat (limited to 'src/mono_reduce.sml')
-rw-r--r-- | src/mono_reduce.sml | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mono_reduce.sml b/src/mono_reduce.sml index 50553560..591d4c1b 100644 --- a/src/mono_reduce.sml +++ b/src/mono_reduce.sml @@ -208,6 +208,20 @@ fun match (env, p : pat, e : exp) = 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 |