Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Parser = Parser ByteString
- anyChar :: Parser Char
- char :: Char -> Parser ()
- checkConsumes :: Parser a -> Parser a
- choice :: Alternative f => [f a] -> f a
- endOfInput :: Chunk t => Parser t ()
- int :: Parser Int
- lexChar :: Char -> Parser ()
- lexString :: ByteString -> Parser ()
- linesStartingWith :: Char -> Parser [ByteString]
- linesStartingWithEndingWith :: Char -> Char -> Parser [ByteString]
- lexWord :: Parser ByteString
- option :: Alternative f => a -> f a -> f a
- optional :: Alternative f => f a -> f (Maybe a)
- parse :: Parser a -> ByteString -> Either String (a, ByteString)
- skipSpace :: Parser ()
- skipWhile :: (Char -> Bool) -> Parser ()
- string :: ByteString -> Parser ()
- take :: Int -> Parser ByteString
- takeTill :: (Char -> Bool) -> Parser ByteString
- takeTillChar :: Char -> Parser ByteString
Documentation
type Parser = Parser ByteString #
checkConsumes :: Parser a -> Parser a Source #
choice :: Alternative f => [f a] -> f a #
choice ps
tries to apply the actions in the list ps
in order,
until one of them succeeds. Returns the value of the succeeding
action.
endOfInput :: Chunk t => Parser t () #
Match only if all input has been consumed.
lexString :: ByteString -> Parser () Source #
linesStartingWith :: Char -> Parser [ByteString] Source #
linesStartingWithEndingWith :: Char -> Char -> Parser [ByteString] Source #
option :: Alternative f => a -> f a -> f a #
option x p
tries to apply action p
. If p
fails without
consuming input, it returns the value x
, otherwise the value
returned by p
.
priority = option 0 (digitToInt <$> digit)
optional :: Alternative f => f a -> f (Maybe a) #
One or none.
parse :: Parser a -> ByteString -> Either String (a, ByteString) Source #
skipWhile :: (Char -> Bool) -> Parser () #
Skip past input for as long as the predicate returns True
.
string :: ByteString -> Parser () Source #
take :: Int -> Parser ByteString #
Consume exactly n
bytes of input.
takeTill :: (Char -> Bool) -> Parser ByteString #
Consume input as long as the predicate returns False
(i.e. until it returns True
), and return the consumed input.
This parser does not fail. It will return an empty string if the
predicate returns True
on the first byte of input.
Note: Because this parser does not fail, do not use it with
combinators such as many
, because such parsers loop until a
failure occurs. Careless use will thus result in an infinite loop.
takeTillChar :: Char -> Parser ByteString Source #