parsley-2.0.0.0: A fast parser combinator library backed by Typed Template Haskell
LicenseBSD-3-Clause
MaintainerJamie Willis
Stabilitystable
Safe HaskellNone
LanguageHaskell2010

Parsley.Applicative

Description

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

Documentation

pure :: ParserOps rep => rep a -> Parser a Source #

Lift a value into the parser world without consuming input or having any other effect.

Since: 0.1.0.0

(<*>) :: Parser (a -> b) -> Parser a -> Parser b infixl 4 Source #

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: 0.1.0.0

(*>) :: Parser a -> Parser b -> Parser b infixl 4 Source #

Sequence two parsers, keeping the result of the first and discarding the result of the second.

Since: 0.1.0.0

(<*) :: Parser a -> Parser b -> Parser a infixl 4 Source #

Sequence two parsers, keeping the result of the second and discarding the result of the first.

Since: 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

constp :: Parser a -> Parser (b -> a) Source #

Since: 0.1.0.0

unit :: Parser () Source #

This parser always returns () without consuming input.

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

(<~) :: Parser a -> Parser b -> Parser a infixl 4 Source #

Alias of (<*)

Since: 0.1.0.0

(~>) :: Parser a -> Parser b -> Parser b infixl 4 Source #

Alias of (*>)

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+1th 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

between :: Parser o -> Parser c -> Parser a -> Parser a Source #

The combinator between open close p will first parse open then p and then close, yielding the result given by p.

Since: 0.1.0.0

(>>) :: Parser a -> Parser b -> Parser b infixl 1 Source #

Alias of (*>)

Since: 0.1.0.0