Text.Pandoc.Pretty: Improve performance of realLength
Eliminates memory usage and twofold increase in speed.
This commit is contained in:
parent
ad242131b9
commit
9761283c8f
1 changed files with 1 additions and 1 deletions
|
@ -534,4 +534,4 @@ charWidth c =
|
||||||
-- | Get real length of string, taking into account combining and double-wide
|
-- | Get real length of string, taking into account combining and double-wide
|
||||||
-- characters.
|
-- characters.
|
||||||
realLength :: String -> Int
|
realLength :: String -> Int
|
||||||
realLength = sum . map charWidth
|
realLength = foldr (\a b -> charWidth a + b) 0
|
||||||
|
|
Loading…
Reference in a new issue