X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FParser%2FHttp.hs;h=4153dcb6eaf62f071e5ba7fe3406daa9d3c4c881;hp=520034247726f3ec6398eb8b69b143eb08456ceb;hb=6126eb9;hpb=558205096e7f51da7018458d173584ac31808082 diff --git a/Network/HTTP/Lucu/Parser/Http.hs b/Network/HTTP/Lucu/Parser/Http.hs index 5200342..4153dcb 100644 --- a/Network/HTTP/Lucu/Parser/Http.hs +++ b/Network/HTTP/Lucu/Parser/Http.hs @@ -1,6 +1,5 @@ {-# LANGUAGE - BangPatterns - , OverloadedStrings + OverloadedStrings , ScopedTypeVariables , UnicodeSyntax #-} @@ -79,18 +78,16 @@ isChar = (≤ '\x7F') -- c)@ isToken ∷ Char → Bool {-# INLINE isToken #-} -isToken !c - = (¬) (isCtl c ∨ isSeparator c) +isToken c = (¬) (isCtl c ∨ isSeparator c) -- |@'listOf' p@ is similar to @'sepBy' p ('char' \',\')@ but it -- allows any occurrences of 'lws' before and after each tokens. listOf ∷ Parser a → Parser [a] {-# INLINEABLE listOf #-} -listOf p - = do skipMany lws - sepBy p $ do skipMany lws - _ <- char ',' - skipMany lws +listOf p = do skipMany lws + sepBy p $ do skipMany lws + _ ← char ',' + skipMany lws -- |'token' is similar to @'takeWhile1' 'isToken'@ token ∷ Parser Ascii @@ -100,12 +97,12 @@ token = A.unsafeFromByteString <$> takeWhile1 isToken -- |The CRLF: 0x0D 0x0A. crlf ∷ Parser () {-# INLINE crlf #-} -crlf = string "\x0D\x0A" ≫ return () +crlf = string "\x0D\x0A" *> return () -- |The SP: 0x20. sp ∷ Parser () {-# INLINE sp #-} -sp = char '\x20' ≫ return () +sp = char '\x20' *> return () -- |HTTP LWS: crlf? (sp | ht)+ lws ∷ Parser () @@ -142,7 +139,7 @@ quotedStr = try $ quotedPair ∷ Parser Char {-# INLINE quotedPair #-} - quotedPair = char '\\' ≫ satisfy isChar + quotedPair = char '\\' *> satisfy isChar -- |'qvalue' accepts a so-called qvalue. qvalue ∷ Parser Double