[Haskell-cafe] 4.4.2 Fixity Declarations - and what happens when they are missing

Johannes Waldmann johannes.waldmann at htwk-leipzig.de
Fri Nov 18 12:09:45 UTC 2016


Yeah, I know, it's bikeshedding,
some 30 years after the fact, but -

How on Earth was this allowed to happen?
"Any operator lacking a fixity declaration
is assumed to be infixl 9"
https://www.haskell.org/onlinereport/haskell2010/haskellch4.html#x10-820061

If I don't specify associativity or precedence for an operator,
then the parser should simply reject any expression
whose meaning would depend on such declarations.

So I'd have to write parentheses at each (ambiguous) use site -
or write a fixity declaration. Both would serve to document the code.
The current situation feels like "the type of identifiers
without type declaration is  int".

Short of repairing the standard - I'd welcome GHC
to print a huge warning for each definition and use (!)
of "operator without fixity decl".

- J.

PS: to show that I did at least some research

* there's no mention of this in 4.2 "Infix operators"
in
http://research.microsoft.com/~simonpj/papers/history-of-haskell/history.pdf

* Scala also has default rules (6.12.3)
"The precedence of an infix operator is determined by
the operator’s first character." "Operators ending in a colon ‘ : ’
are right-associative. All other operators are left-associative."

and why do I care at all? This:
https://github.com/jwaldmann/haskell-obdd/issues/1



More information about the Haskell-Cafe mailing list