]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/MIMEType/Guess.hs
Use base64-bytestring instead of dataenc
[Lucu.git] / Network / HTTP / Lucu / MIMEType / Guess.hs
index d6c4958db21f563bbdc6bd07af3cb02d809f8ffc..39de37e07d68464b8029021f745e956fa236c036 100644 (file)
@@ -1,3 +1,7 @@
+{-# LANGUAGE
+    UnboxedTuples
+  , UnicodeSyntax
+  #-}
 -- |MIME Type guessing by a file extension. This is a poor man's way
 -- of guessing MIME Types. It is simple and fast.
 --
@@ -21,7 +25,6 @@ import           Network.HTTP.Lucu.MIMEType
 import           Network.HTTP.Lucu.Parser
 import           Network.HTTP.Lucu.Parser.Http
 import           Network.HTTP.Lucu.Utils
-import           System.IO
 
 -- |'Data.Map.Map' from extension to MIME Type.
 type ExtMap = Map String MIMEType
@@ -56,14 +59,14 @@ extMapP = do xs <- many (comment <|> validLine <|> emptyLine)
     where
       spc = oneOf " \t"
 
-      comment = do many spc
-                   char '#'
-                   many $ satisfy (/= '\n')
-                   return Nothing
+      comment = many spc >>
+                char '#' >>
+                ( many $ satisfy (/= '\n') ) >>
+                return Nothing
 
-      validLine = do many spc
+      validLine = do _    <- many spc
                      mime <- mimeTypeP
-                     many spc
+                     _    <- many spc
                      exts <- sepBy token (many spc)
                      return $ Just (mime, exts)
 
@@ -102,9 +105,9 @@ serializeExtMap extMap moduleName variableName
                                   [] (HsUnGuardedRhs extMapExp) []]
                      ]
           extMapExp = HsApp (HsVar (Qual (Module "M") (HsIdent "fromList"))) (HsList records)
-          comment =    "{- !!! WARNING !!!\n"
-                    ++ "   This file is automatically generated.\n"
-                    ++ "   DO NOT EDIT BY HAND OR YOU WILL REGRET -}\n\n"
+          comment   =    "{- !!! WARNING !!!\n"
+                      ++ "   This file is automatically generated.\n"
+                      ++ "   DO NOT EDIT BY HAND OR YOU WILL REGRET -}\n\n"
       in
         comment ++ prettyPrint hsModule ++ "\n"
     where