From 77693dca3e81c1739d796dd8e433eabf12c1c2c4 Mon Sep 17 00:00:00 2001 From: krangelov Date: Tue, 14 Dec 2021 09:25:08 +0100 Subject: [PATCH] one more trivial optimization for string patterns --- src/compiler/GF/Compile/TypeCheck/Concrete.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/GF/Compile/TypeCheck/Concrete.hs b/src/compiler/GF/Compile/TypeCheck/Concrete.hs index 5ff41f487..efc2bf0c6 100644 --- a/src/compiler/GF/Compile/TypeCheck/Concrete.hs +++ b/src/compiler/GF/Compile/TypeCheck/Concrete.hs @@ -356,8 +356,9 @@ measurePatt gr p = -> do (min1,max1,p1) <- measurePatt gr p1 (min2,max2,p2) <- measurePatt gr p2 case (p1,p2) of - (PW,PW) -> return (0,Nothing,PW) - _ -> return (min1+min2,liftM2 (+) max1 max2,PSeq min1 max1 p1 min2 max2 p2) + (PW, PW ) -> return (0,Nothing,PW) + (PString s1,PString s2) -> return (min1+min2,liftM2 (+) max1 max2,PString (s1++s2)) + _ -> return (min1+min2,liftM2 (+) max1 max2,PSeq min1 max1 p1 min2 max2 p2) PRep _ _ p -> do (minp,maxp,p) <- measurePatt gr p case p of PW -> return (0,Nothing,PW)