Module

Text.Parsing.StringParser.Combinators

This module defines combinators for building string parsers.

#lookAhead

lookAhead :: forall a. Parser a -> Parser a

Read ahead without consuming input.

#many

many :: forall a. Parser a -> Parser (List a)

Match zero or more times.

#many1

many1 :: forall a. Parser a -> Parser (NonEmptyList a)

Match one or more times.

#withError

withError :: forall a. Parser a -> String -> Parser a

Provide an error message in case of failure.

#(<?>)

Operator alias for Text.Parsing.StringParser.Combinators.withError (left-associative / precedence 3)

#between

between :: forall a open close. Parser open -> Parser close -> Parser a -> Parser a

Parse a string between opening and closing markers.

#option

option :: forall a. a -> Parser a -> Parser a

Parse a value with a default value in case of failure.

#optional

optional :: forall a. Parser a -> Parser Unit

Attempt to parse a value.

#optionMaybe

optionMaybe :: forall a. Parser a -> Parser (Maybe a)

Attempt to parse a value, pureing Nothing in case of failure.

#sepBy

sepBy :: forall a sep. Parser a -> Parser sep -> Parser (List a)

Parse zero or more separated values.

#sepBy1

sepBy1 :: forall a sep. Parser a -> Parser sep -> Parser (NonEmptyList a)

Parse one or more separated values.

#sepEndBy

sepEndBy :: forall a sep. Parser a -> Parser sep -> Parser (List a)

Parse zero or more separated values, optionally ending with a separator.

#sepEndBy1

sepEndBy1 :: forall a sep. Parser a -> Parser sep -> Parser (NonEmptyList a)

Parse one or more separated values, optionally ending with a separator.

#endBy1

endBy1 :: forall a sep. Parser a -> Parser sep -> Parser (NonEmptyList a)

Parse one or more separated values, ending with a separator.

#endBy

endBy :: forall a sep. Parser a -> Parser sep -> Parser (List a)

Parse zero or more separated values, ending with a separator.

#chainr

chainr :: forall a. Parser a -> Parser (a -> a -> a) -> a -> Parser a

Parse zero or more values separated by a right-associative operator.

#chainl

chainl :: forall a. Parser a -> Parser (a -> a -> a) -> a -> Parser a

Parse zero or more values separated by a left-associative operator.

#chainl1

chainl1 :: forall a. Parser a -> Parser (a -> a -> a) -> Parser a

Parse one or more values separated by a left-associative operator.

#chainl1'

chainl1' :: forall a. Parser a -> Parser (a -> a -> a) -> a -> Parser a

Parse one or more values separated by a left-associative operator.

#chainr1

chainr1 :: forall a. Parser a -> Parser (a -> a -> a) -> Parser a

Parse one or more values separated by a right-associative operator.

#chainr1'

chainr1' :: forall a. Parser a -> Parser (a -> a -> a) -> a -> Parser a

Parse one or more values separated by a right-associative operator.

#choice

choice :: forall f a. Foldable f => f (Parser a) -> Parser a

Parse using any of a collection of parsers.

#manyTill

manyTill :: forall a end. Parser a -> Parser end -> Parser (List a)

Parse values until a terminator.

#many1Till

many1Till :: forall a end. Parser a -> Parser end -> Parser (NonEmptyList a)

Parse values until the terminator matches, requiring at least one match.

Re-exports from Control.Lazy

#fix

fix :: forall l. Lazy l => (l -> l) -> l

fix defines a value as the fixed point of a function.

The Lazy instance allows us to generate the result lazily.

Modules