]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/MIMEType.hs
Fixed breakage on GHC 6.10.1
[Lucu.git] / Network / HTTP / Lucu / MIMEType.hs
index 396a1646dbe7a5b297c2d27c8f1b834b37131b4c..e28238e53297237f633dc4bcca4f581f4f0f102f 100644 (file)
@@ -1,4 +1,4 @@
--- #prune
+{-# OPTIONS_HADDOCK prune #-}
 
 -- |Manipulation of MIME Types.
 module Network.HTTP.Lucu.MIMEType
@@ -9,9 +9,11 @@ module Network.HTTP.Lucu.MIMEType
     )
     where
 
+import qualified Data.ByteString.Lazy as B
 import           Network.HTTP.Lucu.Parser
 import           Network.HTTP.Lucu.Parser.Http
 import           Network.HTTP.Lucu.Utils
+import           Prelude hiding (min)
 
 -- |@'MIMEType' \"major\" \"minor\" [(\"name\", \"value\")]@
 -- represents \"major\/minor; name=value\".
@@ -45,8 +47,10 @@ instance Read MIMEType where
 -- exception for parse error.
 parseMIMEType :: String -> MIMEType
 parseMIMEType str = case parseStr mimeTypeP str of
-                      (Success t, _) -> t
-                      _              -> error ("Unparsable MIME Type: " ++ str)
+                      (# Success t, r #) -> if B.null r
+                                            then t
+                                            else error ("unparsable MIME Type: " ++ str)
+                      (# _        , _ #) -> error ("unparsable MIME Type: " ++ str)
 
 
 mimeTypeP :: Parser MIMEType