]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/MIMEType.hs
Optimized as possible as I can.
[Lucu.git] / Network / HTTP / Lucu / MIMEType.hs
index b41bbcd50f07b9857625e08ac7dda9107faef95a..9f653230d3597ae298cdeec99fca07276242b9f6 100644 (file)
@@ -18,9 +18,9 @@ import           Network.HTTP.Lucu.Utils
 -- |@'MIMEType' \"major\" \"minor\" [(\"name\", \"value\")]@
 -- represents \"major\/minor; name=value\".
 data MIMEType = MIMEType {
-      mtMajor  :: String
-    , mtMinor  :: String
-    , mtParams :: [ (String, String) ]
+      mtMajor  :: !String
+    , mtMinor  :: !String
+    , mtParams :: ![ (String, String) ]
     } deriving (Eq)
 
 
@@ -52,7 +52,8 @@ maj </> min
 -- |This operator appends a @(name, value)@ pair to a MIME Type.
 (<:>) :: MIMEType -> (String, String) -> MIMEType
 mt@(MIMEType _ _ params) <:> pair
-    = mt {
+    = pair `seq`
+      mt {
         mtParams = mtParams mt ++ [pair]
       }
 
@@ -67,7 +68,7 @@ name <=> value = (name, value)
 
 
 mimeTypeP :: Parser MIMEType
-mimeTypeP = allowEOF $
+mimeTypeP = allowEOF $!
             do maj <- token
                char '/'
                min <- token
@@ -84,4 +85,4 @@ mimeTypeP = allowEOF $
                   return (name, value)
 
 mimeTypeListP :: Parser [MIMEType]
-mimeTypeListP = allowEOF $ listOf mimeTypeP
+mimeTypeListP = allowEOF $! listOf mimeTypeP