)
where
-import Data.List
import Network.HTTP.Lucu.Parser
-- |@'isCtl' c@ is 'Prelude.False' iff @0x20 <= @c@ < 0x7F@.
-- ('Network.HTTP.Lucu.Parser.char' \',\')@ but it allows any
-- occurrences of LWS before and after each tokens.
listOf :: Parser a -> Parser [a]
-listOf p = p `seq`
- do many lws
- sepBy p $! do many lws
- char ','
- many lws
+listOf !p = do _ <- many lws
+ sepBy p $! do _ <- many lws
+ _ <- char ','
+ many lws
-- |'token' is equivalent to @'Network.HTTP.Lucu.Parser.many1' $
-- 'Network.HTTP.Lucu.Parser.satisfy' 'isToken'@
-- |'quotedStr' accepts a string surrounded by double quotation
-- marks. Quotes can be escaped by backslashes.
quotedStr :: Parser String
-quotedStr = do char '"'
+quotedStr = do _ <- char '"'
xs <- many (qdtext <|> quotedPair)
- char '"'
+ _ <- char '"'
return $ foldr (++) "" xs
where
qdtext = do c <- satisfy (/= '"')
return [c]
- quotedPair = do char '\\'
+ quotedPair = do _ <- char '\\'
c <- satisfy isChar
return [c]