]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/ETag.hs
The attoparsec branch. It doesn't even compile for now.
[Lucu.git] / Network / HTTP / Lucu / ETag.hs
index cbbe4618460e5a89c7755028cb5effa10422794e..41e99f867c694a25eec3ca8a4f3cc498a884d999 100644 (file)
@@ -1,4 +1,4 @@
--- #prune
+{-# OPTIONS_HADDOCK prune #-}
 
 -- |Manipulation of entity tags.
 module Network.HTTP.Lucu.ETag
@@ -9,20 +9,18 @@ module Network.HTTP.Lucu.ETag
     , eTagListP
     )
     where
-
-import           Control.Monad
-import           Network.HTTP.Lucu.Parser
-import           Network.HTTP.Lucu.Parser.Http
-import           Network.HTTP.Lucu.Utils
+import Control.Monad
+import Network.HTTP.Lucu.Parser.Http hiding (token)
+import Network.HTTP.Lucu.Utils
 
 -- |An entity tag is made of a weakness flag and a opaque string.
 data ETag = ETag {
       -- |The weakness flag. Weak tags looks like W\/\"blahblah\" and
       -- strong tags are like \"blahblah\".
-      etagIsWeak :: Bool
+      etagIsWeak :: !Bool
       -- |An opaque string. Only characters from 0x20 (sp) to 0x7e (~)
       -- are allowed.
-    , etagToken  :: String
+    , etagToken  :: !String
     } deriving (Eq)
 
 instance Show ETag where
@@ -33,13 +31,13 @@ instance Show ETag where
                                ++
                                quoteStr token
 
--- |This is equivalent to @'ETag' False@. If you want to generate
--- an ETag from a file, try using
+-- |This is equivalent to @'ETag' 'Prelude.False'@. If you want to
+-- generate an ETag from a file, try using
 -- 'Network.HTTP.Lucu.StaticFile.generateETagFromFile'.
 strongETag :: String -> ETag
 strongETag = ETag False
 
--- |This is equivalent to @'ETag' True@.
+-- |This is equivalent to @'ETag' 'Prelude.True'@.
 weakETag :: String -> ETag
 weakETag = ETag True
 
@@ -52,7 +50,7 @@ eTagP = do isWeak <- option False (string "W/" >> return True)
 
 eTagListP :: Parser [ETag]
 eTagListP = allowEOF
-            $ do xs <- listOf eTagP
-                 when (null xs)
-                          $ fail ""
-                 return xs
+            $! do xs <- listOf eTagP
+                  when (null xs)
+                           $ fail ""
+                  return xs