| License | BSD-3-Clause |
|---|---|
| Maintainer | Jamie Willis |
| Stability | stable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Parsley.ParserOps
Description
Documentation
class ParserOps rep where Source #
This typeclass is used to allow abstraction of the representation of user-level functions. See the instances for information on what these representations are. This may be required as a constraint on custom built combinators that make use of one of the minimal required methods of this class.
Since: 0.1.0.0
Methods
pure :: 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
Arguments
| :: rep (Char -> Bool) | The predicate that a character must satisfy to be parsed |
| -> Parser Char | A parser that matches a single character matching the predicate |
Attempts to read a single character matching the provided predicate. If it succeeds, the character will be returned and consumed, otherwise the parser will fail having consumed no input.
Since: 0.1.0.0
Arguments
| :: [(rep (a -> Bool), Parser b)] | A list of predicates and their outcomes |
| -> Parser a | A parser whose result is used to choose an outcome |
| -> Parser b | A parser who will be executed if no predicates succeed |
| -> Parser b |
conditional fqs p def first parses p, then it will try each of the predicates in fqs in turn
until one of them returns True. The corresponding parser for the first predicate that succeeded
is then executes, or if none of the predicates succeeded then the def parser is executed.
Since: 0.1.0.0
Instances
| ParserOps Defunc Source # | This is used to allow defunctionalised versions of many standard Haskell functions to be used directly as an argument to relevant combinators. Since: 0.1.0.0 |
| x ~ WQ => ParserOps x Source # | This is the default representation used for user-level functions and values: plain old code. Since: 0.1.0.0 |