[Haskell-cafe] referential transparency? (for fixity of local operators)
roma at ro-che.info
Fri Oct 5 13:22:10 CEST 2012
* Johannes Waldmann <waldmann at imn.htwk-leipzig.de> [2012-10-05 11:11:48+0000]
> I was really surprised at the following:
> *Main> 1 + 2 * 3
> *Main> ( \ (+) (*) -> 1 + 2 * 3 ) (+) (*)
> because I was somehow assuming that either
> a) the Prelude fixities of the operators are kept
> b) or they are undefined, so the parser rejects.
> but the Haskell standard says "Any operator lacking a fixity declaration
> is assumed to be infixl 9". This really should be "infix 9"?
This behaviour is really handy when you use functions as operators
(using backticks notation). They typically lack infix annotations, but
having to put parentheses would be very annoying.
More information about the Haskell-Cafe