Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Pratter.Operators
SourceThe elements of that type drive the parser telling it which input tokens are operators.
infix is a pr
tells the parser that for any input i
, if is i
is true, then it's an infix operator with associativity a
and precedence pr
.
For example, use infix = Neither 10.
to consider the equality =
as infix with no associativity so that you can parse x = y
.
prefix is pr
tells the parser that for any input i
, if is i
is true, then it's a prefix operator with precedence pr
.
For example, use prefix ¬ 1.
to consider the negation ¬
as a prefix operator so that you can parse ¬ x
.
postfix is pr
tells the parser that for any input i
, if is i
is true, then it's a postfix operator with precedence pr
.
For example, use postfix ! 1.
to consider the factorial !
as a postfix operator so that you can parse x !
.
o <+> p
tells the parser to consider the operators specified in o
and in p
.
Note that through none
and (<+>)
, the type 'a t
is a semi-group. You can use infix
, prefix
and postfix
to generate initial values and combine them with (<+>)
.