- data Parser s r
- anySymbol :: Parser s s
- satisfy :: (s -> Bool) -> Parser s s
- empty :: Alternative f => forall a. f a
- failp :: Parser s a
- succeed :: a -> Parser s a
- pure :: Applicative f => forall a. a -> f a
- (<|>) :: Alternative f => forall a. f a -> f a -> f a
- (<<|>) :: Parser s a -> Parser s a -> Parser s a
- (<*>) :: Applicative f => forall a b. f (a -> b) -> f a -> f b
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- (>>=) :: Monad m => forall a b. m a -> (a -> m b) -> m b
- look :: Parser s [s]
- parse :: Parser s a -> [s] -> [(a, [s])]
The type of parsers
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.
Monad (Parser s) | |
Functor (Parser s) | |
MonadPlus (Parser s) | |
Applicative (Parser s) | |
Alternative (Parser s) |
Elementary parsers
satisfy :: (s -> Bool) -> Parser s sSource
Takes a predicate and returns a parser that parses a single symbol satisfying that predicate.
empty :: Alternative f => forall a. f a
The identity of <|>
pure :: Applicative f => forall a. a -> f a
Lift a value.
Parser combinators
(<|>) :: Alternative f => forall a. f a -> f a -> f a
An associative binary operation
(<<|>) :: Parser s a -> Parser s a -> Parser s aSource
Biased choice. If the left hand side parser succeeds, the right hand side is not considered. Use with care!
(<*>) :: Applicative f => forall a b. f (a -> b) -> f a -> f b
Sequential application.
(>>=) :: Monad m => forall a b. m a -> (a -> m b) -> m b
Sequentially compose two actions, passing any value produced by the first as an argument to the second.