on master help sign in
2 files changed+10−14
since splitsnapshots
unifiedsplit
Data/Text/Internal/Fusion/Common.hs+9−10 tests/Tests/Properties.hs+1−4
Data/Text/Internal/Fusion/Common.hs+9−10
@@ -107,7 +107,7 @@ import Prelude (Bool(..), Char, Eq(..), Int, Integral, Maybe(..),
107107import qualified Data.List as L
108108import qualified Prelude as P
109109import Data.Bits (shiftL)
110−import Data.Char (isLetter, isSpace)
110+import Data.Char (isLetter)
111111import Data.Int (Int64)
112112import Data.Text.Internal.Fusion.Types
113113import Data.Text.Internal.Fusion.CaseMapping (foldMapping, lowerMapping, titleMapping,
@@ -462,16 +462,15 @@ toTitle (Stream next0 s0 len) = Stream next (CC (False :*: s0) '\0' '\0') len
462462 where
463463 next (CC (letter :*: s) '\0' _) =
464464 case next0 s of
465− Done -> Done
466− Skip s' -> Skip (CC (letter :*: s') '\0' '\0')
465+ Done -> Done
466+ Skip s' -> Skip (CC (letter :*: s') '\0' '\0')
467467 Yield c s'
468− | nonSpace -> if letter
469− then lowerMapping c (nonSpace :*: s')
470− else titleMapping c (letter' :*: s')
471− | otherwise -> Yield c (CC (letter' :*: s') '\0' '\0')
472− where nonSpace = P.not (isSpace c)
473− letter' = isLetter c
474− next (CC s a b) = Yield a (CC s b '\0')
468+ | letter' -> if letter
469+ then lowerMapping c (letter' :*: s')
470+ else titleMapping c (letter' :*: s')
471+ | otherwise -> Yield c (CC (letter' :*: s') '\0' '\0')
472+ where letter' = isLetter c
473+ next (CC s a b) = Yield a (CC s b '\0')
475474{-# INLINE [0] toTitle #-}
476475
477476data Justify i s = Just1 !i !s
tests/Tests/Properties.hs+1−4
@@ -326,8 +326,6 @@ t_toUpper_upper t = p (T.toUpper t) >= p t
326326 where p = T.length . T.filter isUpper
327327tl_toUpper_upper t = p (TL.toUpper t) >= p t
328328 where p = TL.length . TL.filter isUpper
329−t_toTitle_title t = all (<= 1) (caps t)
330− where caps = fmap (T.length . T.filter isUpper) . T.words . T.toTitle
331329
332330justifyLeft k c xs = xs ++ L.replicate (k - length xs) c
333331justifyRight m n xs = L.replicate (m - length xs) n ++ xs
@@ -1032,8 +1030,7 @@ tests =
10321030 testProperty "tl_toLower_lower" tl_toLower_lower,
10331031 testProperty "t_toUpper_length" t_toUpper_length,
10341032 testProperty "t_toUpper_upper" t_toUpper_upper,
1035− testProperty "tl_toUpper_upper" tl_toUpper_upper,
1036− testProperty "t_toTitle_title" t_toTitle_title
1033+ testProperty "tl_toUpper_upper" tl_toUpper_upper
10371034 ],
10381035
10391036 testGroup "justification" [