License | BSD-3-Clause |
---|---|
Maintainer | Jamie Willis |
Stability | stable |
Safe Haskell | None |
Language | Haskell2010 |
This module exposes the required machinery for parsing expressions given by a precedence table. Unlike those found in parser-combinators or parsec, this implementation allows the precedence layers to change type in the table.
Since: 0.1.0.0
Documentation
class Monolith a b c where Source #
This class provides a way of working with the Level
datatype without needing to
provide wrappers, or not providing Defunc
arguments.
Since: 0.1.0.0
infixL :: [Parser (b -> a -> b)] -> c Source #
Used to construct a precedence level of infix left-associative operators
infixR :: [Parser (a -> b -> b)] -> c Source #
Used to construct a precedence level of infix right-associative operators
prefix :: [Parser (b -> b)] -> c Source #
Used to construct a precedence level of prefix operators
postfix :: [Parser (b -> b)] -> c Source #
Used to construct a precedence level of postfix operators
Instances
x ~ (WQ (a -> b) -> Level a b) => Monolith a b x Source # | This instance is used to handle non-monolithic types: i.e. where the input and output types of a level differ. Since: 0.1.0.0 |
x ~ a => Monolith x a (Level a a) Source # | This instance is used to handle monolithic types where the input and output are the same, it does not require the wrapping function to be provided. Since: 0.1.0.0 |
This datatype represents levels of the precedence table Prec
, where each constructor
takes many parsers of the same level and fixity.
Since: 0.1.0.0
InfixL [Parser (b -> a -> b)] (Defunc (a -> b)) | left-associative infix operators |
InfixR [Parser (a -> b -> b)] (Defunc (a -> b)) | right-associative infix operators |
Prefix [Parser (b -> b)] (Defunc (a -> b)) | prefix unary operators |
Postfix [Parser (b -> b)] (Defunc (a -> b)) | postfix unary operators |
A heterogeneous list that represents a precedence table so that Prec a b
transforms the type a
into b
via various layers of operators.
Since: 0.1.0.0