- type Parser s r = [s] -> [(r, [s])]
- anySymbol :: Parser s s
- satisfy :: (s -> Bool) -> Parser s s
- empty :: Parser s a
- failp :: Parser s a
- succeed :: a -> Parser s a
- pure :: a -> Parser s a
- (<|>) :: Parser s a -> Parser s a -> Parser s a
- (<<|>) :: (t -> [a]) -> (t -> [a]) -> t -> [a]
- (<*>) :: Parser s (b -> a) -> Parser s b -> Parser s a
- (<$>) :: (a -> b) -> Parser s a -> Parser s b
- (>>=) :: Parser s a -> (a -> Parser s b) -> Parser s b
- look :: Parser s [s]
- parse :: Parser s a -> [s] -> [(a, [s])]

# The type of parsers

type Parser s r = [s] -> [(r, [s])]Source

An input string is mapped to a list of successful parses.
For each succesful parse, we return the result of type `r`

,
and the remaining input string. The input must be a list of
symbols.

# Elementary parsers

satisfy :: (s -> Bool) -> Parser s sSource

Takes a predicate and returns a parser that parses a single symbol satisfying that predicate.

Same as `succeed`

; provided for compatiblity with the applicative
interface.

# Parser combinators

(<|>) :: Parser s a -> Parser s a -> Parser s aSource

Choice between two parsers with the same result type.

(<*>) :: Parser s (b -> a) -> Parser s b -> Parser s aSource

Biased choice. If the left hand side parser succeeds, the right hand side is not considered. Use with care!

Sequence of two parsers.

(>>=) :: Parser s a -> (a -> Parser s b) -> Parser s bSource

Monadic bind. Do not use this combinator unless absolutely
required. Most sequencing can be done with `<*>`

.