import Data.Sequence.Unicode hiding ((∅))
import Prelude.Unicode
--- |@'isCtl' c@ is 'Prelude.False' iff @0x20 <= c < 0x7F@.
+-- |@'isCtl' c@ returns 'False' iff @0x20 <= c < 0x7F@.
isCtl ∷ Char → Bool
{-# INLINE isCtl #-}
isCtl c
{-# INLINE isText #-}
isText = (¬) ∘ isCtl
--- |@'isSeparator' c@ is 'Prelude.True' iff c is one of HTTP
+-- |@'isSeparator' c@ returns 'True' iff c is one of the HTTP
-- separators.
isSeparator ∷ Char → Bool
{-# INLINE isSeparator #-}
{-# NOINLINE set #-}
set = FS.charClass "()<>@,;:\\\"/[]?={}\x20\x09"
--- |@'isChar' c@ is 'Prelude.True' iff @c <= 0x7f@.
+-- |@'isChar' c@ returns 'True' iff @c <= 0x7f@.
isChar ∷ Char → Bool
{-# INLINE isChar #-}
isChar = (≤ '\x7F')
--- |@'isToken' c@ is equivalent to @not ('isCtl' c || 'isSeparator'
+-- |@'isToken' c@ is equivalent to @not ('isCtl' c '||' 'isSeparator'
-- c)@
isToken ∷ Char → Bool
{-# INLINE isToken #-}
_ ← char ','
skipMany lws
--- |'token' is similar to @'takeWhile1' 'isToken'@
+-- |'token' is almost the same as @'takeWhile1' 'isToken'@
token ∷ Parser Ascii
{-# INLINE token #-}
token = A.unsafeFromByteString <$> takeWhile1 isToken
isSPHT '\x09' = True
isSPHT _ = False
--- |@'separators'@ is similar to @'takeWhile1' 'isSeparator'@.
+-- |@'separators'@ is almost the same as @'takeWhile1' 'isSeparator'@.
separators ∷ Parser Ascii
{-# INLINE separators #-}
separators = A.unsafeFromByteString <$> takeWhile1 isSeparator
return (y:ys)
return $ read (x:xs)
--- |@'atMost' n v@ is like @'P.many' v@ but applies the given action
--- at most @n@ times.
+-- |@'atMost' n v@ is like @'P.many' v@ but accumulates @v@ at most
+-- @n@ times.
atMost ∷ Alternative f ⇒ Int → f a → f [a]
{-# INLINE atMost #-}
atMost 0 _ = pure []
<|>
pure []
-
data CharAccumState
= CharAccumState {
casChunks ∷ !(S.Seq BS.ByteString)
in
str
+-- |@'manyCharsTill' p end@ takes as many characters untill @p@
+-- succeeds.
manyCharsTill ∷ ∀m b. (Monad m, Alternative m)
⇒ m Char
→ m b