Safe Haskell | Safe |
---|---|
Language | Haskell98 |
ParseLib.Parallel.Derived
Contents
Synopsis
- module ParseLib.Parallel.Core
- (<$) :: b -> Parser s a -> Parser s b
- (<*) :: Parser s a -> Parser s b -> Parser s a
- (*>) :: Parser s a -> Parser s b -> Parser s b
- epsilon :: Parser s ()
- symbol :: Eq s => s -> Parser s s
- token :: Eq s => [s] -> Parser s [s]
- pack :: Parser s a -> Parser s b -> Parser s c -> Parser s b
- sequence :: [Parser s a] -> Parser s [a]
- choice :: [Parser s a] -> Parser s a
- option :: Parser s a -> a -> Parser s a
- optional :: Parser s a -> Parser s (Maybe a)
- many :: Parser s a -> Parser s [a]
- some :: Parser s a -> Parser s [a]
- many1 :: Parser s a -> Parser s [a]
- listOf :: Parser s a -> Parser s b -> Parser s [a]
- chainr :: Parser s a -> Parser s (a -> a -> a) -> Parser s a
- chainl :: Parser s a -> Parser s (a -> a -> a) -> Parser s a
- greedy :: Parser s b -> Parser s [b]
- greedy1 :: Parser s b -> Parser s [b]
- eof :: Parser s ()
Documentation
module ParseLib.Parallel.Core
Derived combinators
(<$) :: b -> Parser s a -> Parser s b infixl 4 Source #
Variant of <$>
that ignores the result of the parser.
f <$ p = const f <$> p
(<*) :: Parser s a -> Parser s b -> Parser s a infixl 4 Source #
Variant of <*>
that ignores the result of the right
argument.
f <* p = const <$> p <*> q
(*>) :: Parser s a -> Parser s b -> Parser s b infixl 4 Source #
Variant of *>
that ignores the result of the left
argument.
f *> p = flip const <$> p <*> q
pack :: Parser s a -> Parser s b -> Parser s c -> Parser s b Source #
Takes three parsers: a delimiter, the parser for the content, and another delimiter. Constructs a sequence of the three, but returns only the result of the enclosed parser.
sequence :: [Parser s a] -> Parser s [a] Source #
Takes a list of parsers and combines them in sequence, returning a list of results.
choice :: [Parser s a] -> Parser s a Source #
Takes a list of parsers and combines them using choice.
EBNF parser combinators
option :: Parser s a -> a -> Parser s a Source #
Parses an optional element. Takes the default value as its second argument.
many :: Parser s a -> Parser s [a] Source #
Parses many, i.e., zero or more, occurrences of a given parser.
some :: Parser s a -> Parser s [a] Source #
Parser some, i.e., one or more, occurrences of a given parser.
many1 :: Parser s a -> Parser s [a] Source #
Same as some
. Provided for compatibility with
the lecture notes.
listOf :: Parser s a -> Parser s b -> Parser s [a] Source #
Takes a parser p
and a separator parser s
. Parses
a sequence of p
s that is separated by s
s.
Chain expression combinators
chainr :: Parser s a -> Parser s (a -> a -> a) -> Parser s a Source #
Takes a parser pe
and an operator parser po
. Parses
a sequence of pe
s separated by po
s. The results are
combined using the operator associated with po
in a
right-associative way.
chainl :: Parser s a -> Parser s (a -> a -> a) -> Parser s a Source #
Takes a parser pe
and an operator parser po
. Parses
a sequence of pe
s separated by po
s. The results are
combined using the operator associated with po
in a
left-associative way.