infixr
Infixr is a fixity declaration used in Haskell (and related languages) to specify that an operator is right-associative and to assign its precedence level. The declaration takes the form infixr n op, where n is an integer from 0 to 9. Higher numbers bind more tightly, and right associativity determines how consecutive occurrences of the operator group in expressions.
The primary purpose of infixr is to influence parsing, not to define the operator’s behavior. The operator
With this declaration, a ++ b ++ c is parsed as a ++ (b ++ c). If the operator were
- Fixity declarations apply at the module level and can be overridden by qualified imports or re-declarations
- The specified precedence only affects parsing order relative to other operators; it does not change the
In fixity management, there are three forms: infixl (left-associative), infixr (right-associative), and infix (non-associative), each with