[Haskell-cafe] Automatic fixity allocation for symbolic operators
Bertram Felgenhauer
bertram.felgenhauer at googlemail.com
Sat Oct 14 13:17:07 EDT 2006
Brian Hulley wrote:
> infixr 9 . !! 9 9.9
> infixr 8 ^, ^^, ** 8 8.8 7.7
> infixl 7 *, /, 7 7
> infixl 6 +, - 6 6
> infixr 5 : , ++ 5 6.6
> infix 4 ==, /=, <, <=, >=, > 4.4 7.4 1 1.4 1.4 1
> infixr 3 && 3.3
> infixr 2 || 2.2
> infixl 1 >>, >>= 1.1 1.14
> infixr 1 =<< 1.14
> infixr 0 $, $! 0 0.9
Ouch.
Really, the first priority in the language should be human readability.
Looking up a fixity isn't that hard, but remembering a rule like this
is pretty awful. You also restrict the freedom of library designers
for no good reason. Precedences aren't usually random ...
As far as editors go I have little sympathy. I also see nothing wrong
with forcing a coder to have at least a module stub that defines its
interface and the operator precedences, to make the parsing work
reliably. You'll have to deal with the case where parsing fails anyway,
and it shouldn't be too hard between failures due to unsufficient
information (which shouldn't be tagged as errors, but maybe give some
other indication) and real errors.
Bertram
More information about the Haskell-Cafe
mailing list