Fixity Declarations


Fixity declarations may appear anywhere in a module that other declarations may appear. They then apply to the entire scope in which they appear (i.e. before and after, but not outside).

  infix <precedence> <nm1> <nm2> ...

declares the names to be infix. TODO: effect?

  infixl <precedence> <nm1> <nm2> ...
  infixr <precedence> <nm1> <nm2> ...

declares the names to be left- or right-associative (binary) operators with the given precedence. The precedence should be a natural number. TODO: effect?

For example,

  infixl 5 _+_

declares the name _+_ to be left associative with a precedence of 5.

TODO: more examples

TODO: what do fixity declarations mean when an operator contains more than one name part? How are overlapping cases handled, for example if _a_, _b_, and _a_b_ are all defined of the same (or different) precedence?