From: PHO Date: Fri, 16 Dec 2011 13:29:19 +0000 (+0900) Subject: use attoparsec-0.10.* and time-http 0.4.* X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=d41d36974cf617970ede1b0d17f7c95970f6a657;p=Lucu.git use attoparsec-0.10.* and time-http 0.4.* --- diff --git a/Lucu.cabal b/Lucu.cabal index 2dcbcc8..c033bb4 100644 --- a/Lucu.cabal +++ b/Lucu.cabal @@ -52,7 +52,7 @@ Library Build-Depends: ascii == 0.0.*, attempt == 0.3.*, - attoparsec == 0.9.*, + attoparsec == 0.10.*, base == 4.*, base-unicode-symbols == 0.2.*, base64-bytestring == 0.1.*, @@ -76,7 +76,7 @@ Library template-haskell == 2.5.*, text == 0.11.*, time == 1.2.*, - time-http == 0.3.*, + time-http == 0.4.*, transformers == 0.2.* if flag(ssl) diff --git a/Network/HTTP/Lucu/Headers.hs b/Network/HTTP/Lucu/Headers.hs index 242d191..ff3213b 100644 --- a/Network/HTTP/Lucu/Headers.hs +++ b/Network/HTTP/Lucu/Headers.hs @@ -22,7 +22,7 @@ import Control.Applicative.Unicode hiding ((∅)) import Control.Monad import Data.Ascii (Ascii, AsciiBuilder, CIAscii) import qualified Data.Ascii as A -import Data.Attoparsec.Char8 as P +import Data.Attoparsec.Char8 import qualified Data.Collections.Newtype.TH as C import Data.List (intersperse) import qualified Data.Map as M (Map) @@ -118,7 +118,7 @@ merge a b -} headers ∷ Parser Headers {-# INLINEABLE headers #-} -headers = do xs ← P.many header +headers = do xs ← many header crlf return $ fromFoldable xs where diff --git a/Network/HTTP/Lucu/MIMEParams.hs b/Network/HTTP/Lucu/MIMEParams.hs index 89b2bfd..fcfee9e 100644 --- a/Network/HTTP/Lucu/MIMEParams.hs +++ b/Network/HTTP/Lucu/MIMEParams.hs @@ -25,7 +25,7 @@ import Control.Monad hiding (mapM) import Control.Monad.Unicode import Data.Ascii (Ascii, CIAscii, AsciiBuilder) import qualified Data.Ascii as A -import Data.Attoparsec.Char8 as P +import Data.Attoparsec.Char8 import Data.Bits import qualified Data.ByteString.Char8 as BS import Data.Char @@ -139,7 +139,7 @@ section ep = epSection ep -- |'Parser' for MIME parameter values. mimeParams ∷ Parser MIMEParams {-# INLINEABLE mimeParams #-} -mimeParams = decodeParams =≪ P.many (try paramP) +mimeParams = decodeParams =≪ many (try paramP) paramP ∷ Parser ExtendedParam paramP = do skipMany lws @@ -186,7 +186,7 @@ initialEncodedValue encodedPayload ∷ Parser BS.ByteString {-# INLINE encodedPayload #-} -encodedPayload = BS.concat <$> P.many (hexChar <|> rawChars) +encodedPayload = BS.concat <$> many (hexChar <|> rawChars) hexChar ∷ Parser BS.ByteString {-# INLINEABLE hexChar #-} diff --git a/Network/HTTP/Lucu/Parser/Http.hs b/Network/HTTP/Lucu/Parser/Http.hs index e59f460..6758d40 100644 --- a/Network/HTTP/Lucu/Parser/Http.hs +++ b/Network/HTTP/Lucu/Parser/Http.hs @@ -30,8 +30,7 @@ import Control.Applicative import Control.Monad import Data.Ascii (Ascii) import qualified Data.Ascii as A -import Data.Attoparsec.Char8 as P hiding (scan) -import qualified Data.Attoparsec.FastSet as FS +import Data.Attoparsec.Char8 import qualified Data.ByteString.Char8 as BS import Network.HTTP.Lucu.Parser import Prelude.Unicode @@ -53,10 +52,7 @@ isText = (¬) ∘ isCtl -- separators. isSeparator ∷ Char → Bool {-# INLINE isSeparator #-} -isSeparator = flip FS.memberChar set - where - {-# NOINLINE set #-} - set = FS.charClass "()<>@,;:\\\"/[]?={}\x20\x09" +isSeparator = inClass "()<>@,;:\\\"/[]?={}\x20\x09" -- |@'isChar' c@ returns 'True' iff @c <= 0x7f@. isChar ∷ Char → Bool @@ -126,7 +122,7 @@ separators = (A.unsafeFromByteString <$> takeWhile1 isSeparator) quotedStr ∷ Parser Ascii {-# INLINEABLE quotedStr #-} quotedStr = do void $ char '"' - xs ← P.many (qdtext <|> quotedPair) + xs ← many (qdtext <|> quotedPair) void $ char '"' return ∘ A.unsafeFromByteString $ BS.pack xs