on master help sign in
buildUnicodeWidthTable: cleanup
commit1faafd71d90d5958a644415644181c6be4872033 authorJonathan Daugherty <cygnus@foobox.com> dateThu 27 Feb 2020, 17:02 (7 years ago) parentf475aaa
1 file changed+2−5
src/Graphics/Vty/UnicodeWidthTable/Query.hs+2−5
src/Graphics/Vty/UnicodeWidthTable/Query.hs+2−5
@@ -6,7 +6,6 @@ where
66
77import Control.Monad (forM)
88import Data.Char (generalCategory, GeneralCategory(..))
9−import Data.Maybe (catMaybes)
109import System.Console.ANSI (getCursorPosition)
1110import Text.Printf (printf)
1211
@@ -64,10 +63,8 @@ unicodeTableUpperBound = '\x2FFFF'
6463-- system performance.
6564buildUnicodeWidthTable :: IO UnicodeWidthTable
6665buildUnicodeWidthTable = do
67− pairs <- fmap catMaybes $ forM ['\0'..unicodeTableUpperBound] $ \i ->
68− if shouldConsider i
69− then (Just . (i,)) <$> charWidth i
70− else return Nothing
66+ pairs <- forM (filter shouldConsider ['\0'..unicodeTableUpperBound]) $ \i ->
67+ (i,) <$> charWidth i
7168
7269 return UnicodeWidthTable { unicodeWidthTableRanges = reverse $ mkRanges pairs
7370 }