diff options
author | Adam Chlipala <adam@chlipala.net> | 2014-08-01 15:44:17 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2014-08-01 15:44:17 -0400 |
commit | b6d4f55981faff6ca7fa8b890c22ff4f33302ef2 (patch) | |
tree | 76d0a9801c5ad0dc1e08f11635a8c2010926586b /src/mono_reduce.sml | |
parent | 8ef3bce7ec88bb0c73a5885bca9f27526a1eae8b (diff) |
Differentiate between HTML and normal string literals
Diffstat (limited to 'src/mono_reduce.sml')
-rw-r--r-- | src/mono_reduce.sml | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mono_reduce.sml b/src/mono_reduce.sml index 98e81185..f1a6758d 100644 --- a/src/mono_reduce.sml +++ b/src/mono_reduce.sml @@ -190,13 +190,13 @@ fun match (env, p : pat, e : exp) = (PWild, _) => Yes env | (PVar (x, t), _) => Yes ((x, t, e) :: env) - | (PPrim (Prim.String s), EStrcat ((EPrim (Prim.String s'), _), _)) => + | (PPrim (Prim.String (_, s)), EStrcat ((EPrim (Prim.String (_, s')), _), _)) => if String.isPrefix s' s then Maybe else No - | (PPrim (Prim.String s), EStrcat (_, (EPrim (Prim.String s'), _))) => + | (PPrim (Prim.String (_, s)), EStrcat (_, (EPrim (Prim.String (_, s')), _))) => if String.isSuffix s' s then Maybe else @@ -756,8 +756,10 @@ fun reduce (file : file) = | ELet (x, t, e', b) => doLet (x, t, e', b) - | EStrcat ((EPrim (Prim.String s1), _), (EPrim (Prim.String s2), _)) => - EPrim (Prim.String (s1 ^ s2)) + | EStrcat ((EPrim (Prim.String (k1, s1)), _), (EPrim (Prim.String (k2, s2)), _)) => + EPrim (Prim.String ((case (k1, k2) of + (Prim.Html, Prim.Html) => Prim.Html + | _ => Prim.Normal), s1 ^ s2)) | ESignalBind ((ESignalReturn e1, loc), e2) => #1 (reduceExp env (EApp (e2, e1), loc)) |