| License | BSD-3-Clause |
|---|---|
| Maintainer | Jamie Willis |
| Stability | stable |
| Safe Haskell | None |
| Language | Haskell2010 |
Parsley.Fold
Description
Synopsis
- many :: Parser a -> Parser [a]
- some :: Parser a -> Parser [a]
- manyN :: Int -> Parser a -> Parser [a]
- skipMany :: Parser a -> Parser ()
- skipSome :: Parser a -> Parser ()
- skipManyN :: Int -> Parser a -> Parser ()
- sepBy :: Parser a -> Parser b -> Parser [a]
- sepBy1 :: Parser a -> Parser b -> Parser [a]
- endBy :: Parser a -> Parser b -> Parser [a]
- endBy1 :: Parser a -> Parser b -> Parser [a]
- sepEndBy :: Parser a -> Parser b -> Parser [a]
- sepEndBy1 :: Parser a -> Parser b -> Parser [a]
- chainl1 :: Parser a -> Parser (a -> a -> a) -> Parser a
- chainr1 :: Parser a -> Parser (a -> a -> a) -> Parser a
- chainl :: ParserOps rep => Parser a -> Parser (a -> a -> a) -> rep a -> Parser a
- chainr :: ParserOps rep => Parser a -> Parser (a -> a -> a) -> rep a -> Parser a
- chainl1' :: ParserOps rep => rep (a -> b) -> Parser a -> Parser (b -> a -> b) -> Parser b
- chainr1' :: ParserOps rep => rep (a -> b) -> Parser a -> Parser (a -> b -> b) -> Parser b
- chainPre :: Parser (a -> a) -> Parser a -> Parser a
- chainPost :: Parser a -> Parser (a -> a) -> Parser a
- pfoldr :: (ParserOps repf, ParserOps repk) => repf (a -> b -> b) -> repk b -> Parser a -> Parser b
- pfoldl :: (ParserOps repf, ParserOps repk) => repf (b -> a -> b) -> repk b -> Parser a -> Parser b
- pfoldr1 :: (ParserOps repf, ParserOps repk) => repf (a -> b -> b) -> repk b -> Parser a -> Parser b
- pfoldl1 :: (ParserOps repf, ParserOps repk) => repf (b -> a -> b) -> repk b -> Parser a -> Parser b
Documentation
many :: Parser a -> Parser [a] Source #
Attempts to parse the given parser zero or more times, collecting all of the successful results
into a list. Same as manyN 0
Since: 0.1.0.0
some :: Parser a -> Parser [a] Source #
Attempts to parse the given parser one or more times, collecting all of the successful results
into a list. Same as manyN 1
Since: 0.1.0.0
manyN :: Int -> Parser a -> Parser [a] Source #
Attempts to parse the given parser n or more times, collecting all of the successful results into a list.
Since: 0.1.0.0
skipManyN :: Int -> Parser a -> Parser () Source #
Like manyN, excepts discards its results.
Since: 0.1.0.0
sepBy :: Parser a -> Parser b -> Parser [a] Source #
sepBy p sep parses zero or more occurrences of p, separated by sep.
Returns a list of values returned by p.
Since: 0.1.0.0
sepBy1 :: Parser a -> Parser b -> Parser [a] Source #
sepBy1 p sep parses one or more occurrences of p, separated by sep.
Returns a list of values returned by p.
Since: 0.1.0.0
endBy :: Parser a -> Parser b -> Parser [a] Source #
endBy p sep parses zero or more occurrences of p, separated and ended by sep.
Returns a list of values returned by p.
Since: 0.1.0.0
endBy1 :: Parser a -> Parser b -> Parser [a] Source #
endBy1 p sep parses one or more occurrences of p, separated and ended by sep.
Returns a list of values returned by p.
Since: 0.1.0.0
sepEndBy :: Parser a -> Parser b -> Parser [a] Source #
sepEndBy p sep parses zero or more occurrences of p, separated and optionally ended by sep.
Returns a list of values returned by p.
Since: 0.1.0.0
sepEndBy1 :: Parser a -> Parser b -> Parser [a] Source #
sepEndBy1 p sep parses one or more occurrences of p, separated and optionally ended by sep.
Returns a list of values returned by p.
Since: 0.1.0.0
chainl1 :: Parser a -> Parser (a -> a -> a) -> Parser a Source #
The classic version of the left-associative chain combinator. See chainl1`.
chainl1 p op = chainl1' ID p op
Since: 0.1.0.0
chainr1 :: Parser a -> Parser (a -> a -> a) -> Parser a Source #
The classic version of the right-associative chain combinator. See chainr1`.
chainr1 p op = chainr1' ID p op
Since: 0.1.0.0
chainl :: ParserOps rep => Parser a -> Parser (a -> a -> a) -> rep a -> Parser a Source #
Like chainl1, but may parse zero occurences of p in which case the value is returned.
Since: 0.1.0.0
chainr :: ParserOps rep => Parser a -> Parser (a -> a -> a) -> rep a -> Parser a Source #
Like chainr1, but may parse zero occurences of p in which case the value is returned.
Since: 0.1.0.0
chainl1' :: ParserOps rep => rep (a -> b) -> Parser a -> Parser (b -> a -> b) -> Parser b Source #
chainl1' wrap p op parses one or more occurrences of p, separated by op. Returns a value obtained
by a left associative application of all functions returned by op to the values returned by p.
The function wrap is used to transform the initial value from p into the correct form.
Since: 0.1.0.0
chainr1' :: ParserOps rep => rep (a -> b) -> Parser a -> Parser (a -> b -> b) -> Parser b Source #
chainr1' wrap p op parses one or more occurrences of p, separated by op. Returns a value obtained
by a right associative application of all functions returned by op to the values returned by p.
The function wrap is used to transform the final value from p into the correct form.
Since: 0.1.0.0
chainPre :: Parser (a -> a) -> Parser a -> Parser a Source #
This combinator parses repeated applications of an operator to a single final operand. This is primarily used to parse prefix operators in expressions.
Since: 0.1.0.0
chainPost :: Parser a -> Parser (a -> a) -> Parser a Source #
This combinator parses repeated applications of an operator to a single initial operand. This is primarily used to parse postfix operators in expressions.
Since: 0.1.0.0
pfoldr :: (ParserOps repf, ParserOps repk) => repf (a -> b -> b) -> repk b -> Parser a -> Parser b Source #
pfoldr f k p parses zero or more ps and combines the results using the function f. When p
fails without consuming input, the terminal result k is returned.
many = pfoldr CONS EMPTY
Since: 0.1.0.0
pfoldl :: (ParserOps repf, ParserOps repk) => repf (b -> a -> b) -> repk b -> Parser a -> Parser b Source #
pfoldl f k p parses zero or more ps and combines the results using the function f. The
accumulator is initialised with the value k.
Since: 0.1.0.0
pfoldr1 :: (ParserOps repf, ParserOps repk) => repf (a -> b -> b) -> repk b -> Parser a -> Parser b Source #
pfoldr1 f k p parses one or more ps and combines the results using the function f. When p
fails without consuming input, the terminal result k is returned.
some = pfoldr1 CONS EMPTY
Since: 0.1.0.0