Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- moptional :: (Alternative p, Monoid a) => p a -> p a
- concatMany :: (Alternative p, Monoid a) => p a -> p a
- concatSome :: (Alternative p, Semigroup a) => p a -> p a
- flag :: Alternative p => p a -> p Bool
- count :: Applicative m => Int -> m a -> m [a]
- upto :: Alternative p => Int -> p a -> p [a]
- delimiter :: (Show s, FactorialMonoid s, LeftReductive s, s ~ ParserInput m, LexicalParsing m) => s -> m s
- operator :: (Show s, FactorialMonoid s, LeftReductive s, s ~ ParserInput m, LexicalParsing m) => s -> m s
- keyword :: LexicalParsing m => ParserInput m -> m ()

# Documentation

moptional :: (Alternative p, Monoid a) => p a -> p a Source #

Attempts to parse a monoidal value, if the argument parser fails returns `mempty`

.

concatMany :: (Alternative p, Monoid a) => p a -> p a Source #

Zero or more argument occurrences like `many`

, with concatenated monoidal results.

concatSome :: (Alternative p, Semigroup a) => p a -> p a Source #

One or more argument occurrences like `some`

, with concatenated monoidal results.

flag :: Alternative p => p a -> p Bool Source #

count :: Applicative m => Int -> m a -> m [a] #

`count n p`

parses `n`

occurrences of `p`

. If `n`

is smaller or
equal to zero, the parser equals to `return []`

. Returns a list of
`n`

values returned by `p`

.

upto :: Alternative p => Int -> p a -> p [a] Source #

Parses between 0 and N occurrences of the argument parser in sequence and returns the list of results.

delimiter :: (Show s, FactorialMonoid s, LeftReductive s, s ~ ParserInput m, LexicalParsing m) => s -> m s Source #

Parses the given delimiter, such as a comma or a brace

operator :: (Show s, FactorialMonoid s, LeftReductive s, s ~ ParserInput m, LexicalParsing m) => s -> m s Source #

Parses the given operator symbol

keyword :: LexicalParsing m => ParserInput m -> m () Source #

Parses the argument word whole, not followed by any identifier character, and consumes the trailing
`lexicalWhitespace`