This module implements some deterministic parsing combinators.
(<*)
:: ([a] -> Either String ([a],b)) -> ([a] -> Either String ([a],c)) -> [a] -> Either String ([a],b)
Combine parsers with resulting representation of first one. |
(*>)
:: ([a] -> Either String ([a],b)) -> ([a] -> Either String ([a],c)) -> [a] -> Either String ([a],c)
Combine parsers with resulting representation of second one. |
(<*>)
:: ([a] -> Either String ([a],b -> c)) -> ([a] -> Either String ([a],b)) -> [a] -> Either String ([a],c)
|
(<|>)
:: ([a] -> Either String ([a],b)) -> ([a] -> Either String ([a],b)) -> [a] -> Either String ([a],b)
Combines two parsers in an alternative manner. |
(<$>)
:: (a -> b) -> ([c] -> Either String ([c],a)) -> [c] -> Either String ([c],b)
Apply unary function f
to result of parser p
|
liftP2
:: (a -> b -> c) -> ([d] -> Either String ([d],a)) -> ([d] -> Either String ([d],b)) -> [d] -> Either String ([d],c)
Apply binary function f
to results of parsers p1
and p2
|
yield
:: a -> [b] -> Either String ([b],a)
A parser with x
as representation while consuming no tokens.
|
terminal
:: a -> [a] -> Either String ([a],())
A parser recognizing a particular terminal symbol. |
eof
:: [a] -> Either String ([a],b)
Returns parse error about unexpected end-of-file |
unexpected
:: a -> [a] -> Either String ([a],b)
Returns parse error about unexpected token t
|
star
:: ([a] -> Either String ([a],b)) -> [a] -> Either String ([a],[b])
A star combinator for parsers. |
some
:: ([a] -> Either String ([a],b)) -> [a] -> Either String ([a],[b])
A some combinator for parsers. |
Type synonym: Parser a b = [a] -> Either ParseError ([a],b)
Type synonym: ParseError = String
Combine parsers with resulting representation of first one. |
Combine parsers with resulting representation of second one. |
|
Combines two parsers in an alternative manner. |
Apply unary function |
Apply binary function |
A parser with
|
A parser recognizing a particular terminal symbol. |
Returns parse error about unexpected end-of-file
|
Returns parse error about unexpected token |
A star combinator for parsers. The returned parser repeats zero or more times a parser p and returns the representation of all parsers in a list. |
A some combinator for parsers. The returned parser repeats the argument parser at least once. |