Skip to content

Commit c18e76e

Browse files
committed
Satisfy -Wincomplete-uni-patterns in precompute-fileinfo
1 parent 09e11ab commit c18e76e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

precompute-fileinfo/src/Main.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{-# LANGUAGE ScopedTypeVariables #-}
2+
13
module Main where
24

35
import Control.Concurrent
@@ -167,13 +169,13 @@ writeMap fp hashes = withFile fp WriteMode $ \h ->
167169
readMap :: FilePath -> IO (Map MD5 (SHA256, Length))
168170
readMap fp =
169171
withFile fp ReadMode $ \h -> do
170-
hashes <- Map.fromList . map parseEntry . lines <$> hGetContents h
172+
hashes <- mapFromParseEntry . lines <$> hGetContents h
171173
evaluate $ rnf hashes
172174
return hashes
173175
where
174-
parseEntry :: String -> (MD5, (SHA256, Length))
175-
parseEntry line = let [md5, sha256, len] = words line
176-
in (md5, (sha256, read len))
176+
mapFromParseEntry :: [String] -> Map MD5 (SHA256, Length)
177+
mapFromParseEntry mapLines = Map.fromList
178+
[(md5, (sha256, read len)) | [md5, sha256, len] <- words <$> mapLines]
177179

178180
{-------------------------------------------------------------------------------
179181
Auxiliary

0 commit comments

Comments
 (0)