]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Chunk.hs
Destroy Data.Attoparsec.Parsable; use Data.Default instead
[Lucu.git] / Network / HTTP / Lucu / Chunk.hs
index a419464eefbc322989141167b8d4cbf8bcc741db..c2135ef1105ae96e85f0f39db1a32240b7ee5929 100644 (file)
@@ -2,34 +2,36 @@
     UnicodeSyntax
   #-}
 module Network.HTTP.Lucu.Chunk
-    ( chunkHeaderP  -- Num a => Parser a
-    , chunkFooterP  -- Parser ()
-    , chunkTrailerP -- Parser Headers
+    ( chunkHeader
+    , chunkFooter
+    , chunkTrailer
     )
     where
 import Control.Applicative
 import Data.Attoparsec.Char8
 import Data.Bits
+import Data.Default
 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 ()
+{-# INLINE chunkFooter #-}
+chunkFooter = crlf
 
-chunkTrailerP ∷ Parser Headers
-chunkTrailerP = headersP
+chunkTrailer ∷ Parser Headers
+{-# INLINE chunkTrailer #-}
+chunkTrailer = def