License | BSD-3-Clause |
---|---|
Maintainer | Jamie Willis |
Stability | stable |
Safe Haskell | None |
Language | Haskell2010 |
This modules contains all of the Applicative
combinators that would normally be found in
Data.Functor
or Control.Applicative
. However, since Parsley makes use of staging, the signatures
of these combinators do not correctly match the signatures of those in base Haskell.
Since: 0.1.0.0
Synopsis
- pure :: ParserOps rep => rep a -> Parser a
- (<*>) :: Parser (a -> b) -> Parser a -> Parser b
- (*>) :: Parser a -> Parser b -> Parser b
- (<*) :: Parser a -> Parser b -> Parser a
- fmap :: ParserOps rep => rep (a -> b) -> Parser a -> Parser b
- (<$>) :: ParserOps rep => rep (a -> b) -> Parser a -> Parser b
- void :: Parser a -> Parser ()
- (<$) :: ParserOps rep => rep b -> Parser a -> Parser b
- ($>) :: ParserOps rep => Parser a -> rep b -> Parser b
- (<&>) :: ParserOps rep => Parser a -> rep (a -> b) -> Parser b
- constp :: Parser a -> Parser (b -> a)
- unit :: Parser ()
- (<~>) :: Parser a -> Parser b -> Parser (a, b)
- (<~) :: Parser a -> Parser b -> Parser a
- (~>) :: Parser a -> Parser b -> Parser b
- liftA2 :: ParserOps rep => rep (a -> b -> c) -> Parser a -> Parser b -> Parser c
- liftA3 :: ParserOps rep => rep (a -> b -> c -> d) -> Parser a -> Parser b -> Parser c -> Parser d
- (<:>) :: Parser a -> Parser [a] -> Parser [a]
- (<**>) :: Parser a -> Parser (a -> b) -> Parser b
- sequence :: [Parser a] -> Parser [a]
- traverse :: (a -> Parser b) -> [a] -> Parser [b]
- repeat :: Int -> Parser a -> Parser [a]
- between :: Parser o -> Parser c -> Parser a -> Parser a
- (>>) :: Parser a -> Parser b -> Parser b
Documentation
pure :: ParserOps rep => rep a -> Parser a #
Lift a value into the parser world without consuming input or having any other effect.
Since: parsley-core-0.1.0.0
(<*>) :: Parser (a -> b) -> Parser a -> Parser b infixl 4 #
Sequential application of one parser's result to another's. The parsers must both succeed, one after the other to combine their results. If either parser fails then the combinator will fail.
Since: parsley-core-0.1.0.0
(*>) :: Parser a -> Parser b -> Parser b infixl 4 #
Sequence two parsers, keeping the result of the first and discarding the result of the second.
Since: parsley-core-0.1.0.0
(<*) :: Parser a -> Parser b -> Parser a infixl 4 #
Sequence two parsers, keeping the result of the second and discarding the result of the first.
Since: parsley-core-0.1.0.0
fmap :: ParserOps rep => rep (a -> b) -> Parser a -> Parser b Source #
Maps a function over the result of a parser.
Since: 0.1.0.0
(<$>) :: ParserOps rep => rep (a -> b) -> Parser a -> Parser b infixl 4 Source #
Alias of fmap
.
Since: 0.1.0.0
void :: Parser a -> Parser () Source #
This combinator "forgets" the result of a parser, and replaces it with ()
.
Since: 0.1.0.0
(<$) :: ParserOps rep => rep b -> Parser a -> Parser b infixl 4 Source #
This combinator "forgets" the result of a parser, and replaces it the given value.
Since: 0.1.0.0
($>) :: ParserOps rep => Parser a -> rep b -> Parser b infixl 4 Source #
This combinator "forgets" the result of a parser, and replaces it the given value.
Since: 0.1.0.0
(<&>) :: ParserOps rep => Parser a -> rep (a -> b) -> Parser b infixl 4 Source #
Maps a function over the result of a parser.
Since: 0.1.0.0
(<~>) :: Parser a -> Parser b -> Parser (a, b) infixl 4 Source #
Sequential zipping of one parser's result with another's. The parsers must both succeed, one after the other to pair their results. If either parser fails then the combinator will fail.
Since: 0.1.0.0
liftA2 :: ParserOps rep => rep (a -> b -> c) -> Parser a -> Parser b -> Parser c Source #
Sequential combination of two parsers results. The results are combined using the given function.
Since: 0.1.0.0
liftA3 :: ParserOps rep => rep (a -> b -> c -> d) -> Parser a -> Parser b -> Parser c -> Parser d Source #
Sequential combination of three parsers results. The results are combined using the given function.
Since: 0.1.0.0
(<:>) :: Parser a -> Parser [a] -> Parser [a] infixl 4 Source #
Sequential consing of one parser's result with another's. The parsers must both succeed, one after the other to combine their results. If either parser fails then the combinator will fail.
Since: 0.1.0.0
(<**>) :: Parser a -> Parser (a -> b) -> Parser b infixl 4 Source #
A variant of (
with the arguments reversed.<*>
)
Since: 0.1.0.0
sequence :: [Parser a] -> Parser [a] Source #
Given a list of parsers, sequence
will parse each in turn and collect all their results into a
list. All the parsers in the list must succeed.
Since: 0.1.0.0
traverse :: (a -> Parser b) -> [a] -> Parser [b] Source #
Like sequence
, but the parsers to sequence are generated from seed values using a given generator
function.
Since: 0.1.0.0
repeat :: Int -> Parser a -> Parser [a] Source #
The combinator repeat n p
will attempt to parse p
exactly n
times. That is not to say that
the parser must fail on the n+1
th try, but there must be n
successes for the combinator to
succeed. All the results generated from p
will be collected into a list.
Since: 0.1.0.0