-- |Guess the MIME Type of file.
guessTypeByFileName :: ExtMap -> FilePath -> Maybe MIMEType
guessTypeByFileName extMap fpath
- = let ext = last $ splitBy (== '.') fpath
+ = extMap `seq` fpath `seq`
+ let ext = last $ splitBy (== '.') fpath
in
M.lookup ext extMap >>= return
-- |Read an Apache mime.types and parse it.
parseExtMapFile :: FilePath -> IO ExtMap
parseExtMapFile fpath
- = do file <- B.readFile fpath
+ = fpath `seq`
+ do file <- B.readFile fpath
case parse (allowEOF extMapP) file of
(Success xs, _) -> return $ compile xs
(_, input') -> let near = B.unpack $ B.take 100 input'