]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Request.hs
Fixed breakage on GHC 6.10.1
[Lucu.git] / Network / HTTP / Lucu / Request.hs
index f8b1c93504bd34cacba81fb6b9c100547fd36025..c98a400c0748ba2c01aa7e9978791d470ccc8833 100644 (file)
@@ -1,18 +1,23 @@
+{-# OPTIONS_HADDOCK prune #-}
+
+-- |Definition of things related on HTTP request.
+--
+-- In general you don't have to use this module directly.
 module Network.HTTP.Lucu.Request
     ( Method(..)
     , Request(..)
-    , requestP -- Parser Request
+    , requestP
     )
     where
 
-import qualified Data.ByteString.Lazy.Char8 as B
-import           Data.ByteString.Lazy.Char8 (ByteString)
 import           Network.HTTP.Lucu.Headers
 import           Network.HTTP.Lucu.HttpVersion
 import           Network.HTTP.Lucu.Parser
 import           Network.HTTP.Lucu.Parser.Http
 import           Network.URI
 
+-- |This is the definition of HTTP request methods, which shouldn't
+-- require any description.
 data Method = OPTIONS
             | GET
             | HEAD
@@ -21,16 +26,16 @@ data Method = OPTIONS
             | DELETE
             | TRACE
             | CONNECT
-            | ExtensionMethod String
+            | ExtensionMethod !String
               deriving (Eq, Show)
 
-
+-- |This is the definition of HTTP reqest.
 data Request
     = Request {
-        reqMethod  :: Method
-      , reqURI     :: URI
-      , reqVersion :: HttpVersion
-      , reqHeaders :: Headers
+        reqMethod  :: !Method
+      , reqURI     :: !URI
+      , reqVersion :: !HttpVersion
+      , reqHeaders :: !Headers
       }
     deriving (Show, Eq)
 
@@ -71,7 +76,7 @@ methodP = (let methods = [ ("OPTIONS", OPTIONS)
                          , ("TRACE"  , TRACE  )
                          , ("CONNECT", CONNECT)
                          ]
-           in foldl (<|>) (fail "") $ map (\ (str, mth)
+           in foldl (<|>) failP $ map (\ (str, mth)
                                            -> string str >> return mth) methods)
           <|>
           token >>= return . ExtensionMethod
@@ -80,5 +85,5 @@ methodP = (let methods = [ ("OPTIONS", OPTIONS)
 uriP :: Parser URI
 uriP = do str <- many1 $ satisfy (\ c -> not (isCtl c || c == ' '))
           case parseURIReference str of
-            Nothing  -> fail ""
+            Nothing  -> failP
             Just uri -> return uri
\ No newline at end of file