X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FChunk.hs;h=e8c9de41286c4fb3240425843acc67c52e565db5;hb=5f2ef377345fc47aabc63c1325df82c1cd9da9ed;hp=a419464eefbc322989141167b8d4cbf8bcc741db;hpb=9bb89434103e9a22f100d6ecb7e65a5d461e0454;p=Lucu.git diff --git a/Network/HTTP/Lucu/Chunk.hs b/Network/HTTP/Lucu/Chunk.hs index a419464..e8c9de4 100644 --- a/Network/HTTP/Lucu/Chunk.hs +++ b/Network/HTTP/Lucu/Chunk.hs @@ -2,9 +2,9 @@ UnicodeSyntax #-} module Network.HTTP.Lucu.Chunk - ( chunkHeaderP -- Num a => Parser a - , chunkFooterP -- Parser () - , chunkTrailerP -- Parser Headers + ( chunkHeader + , chunkFooter + , chunkTrailer ) where import Control.Applicative @@ -13,23 +13,22 @@ import Data.Bits import Network.HTTP.Lucu.Headers import Network.HTTP.Lucu.Parser.Http -chunkHeaderP ∷ (Integral a, Bits a) ⇒ Parser a -{-# INLINEABLE chunkHeaderP #-} -chunkHeaderP = do len ← hexadecimal - extension - crlf - return len +chunkHeader ∷ (Integral a, Bits a) ⇒ Parser a +{-# INLINEABLE chunkHeader #-} +chunkHeader = do len ← hexadecimal + extension + crlf + return len where extension ∷ Parser () - extension = skipMany $ - do _ ← char ';' - _ ← token - _ ← char '=' - _ ← token <|> quotedStr - return () + extension + = skipMany ( char ';' *> + token *> + char '=' *> + (token <|> quotedStr) ) -chunkFooterP ∷ Parser () -chunkFooterP = crlf +chunkFooter ∷ Parser () +chunkFooter = crlf -chunkTrailerP ∷ Parser Headers -chunkTrailerP = headersP +chunkTrailer ∷ Parser Headers +chunkTrailer = headers