[Haskell-cafe] Fractional/negative fixity?

Simon Marlow simonmar at microsoft.com
Tue Nov 7 11:43:26 EST 2006

Henning Thielemann wrote:
> On Tue, 7 Nov 2006, Simon Marlow wrote:
>> I'd support fractional and negative fixity.  It's a simple change to
>> make, but we also have to adopt
> http://hackage.haskell.org/cgi-bin/haskell-prime/trac.cgi/wiki
> /FixityResolution
>> I've added the proposal to the end of that page.  In fact, the page
>> already mentioned that we could generalise fixity levels, but it
>> didn't mention fractional or negative values being allowed.
> Maybe that page could also mention earlier proposals and the solutions
> without precedence numbers. I prefer the non-numeric approach
> with rules
> like "(<) binds more tightly than (&&)", because it says what
> is intended
> and it allows to make things unrelated that are unrelated, e.g. infix
> operators from different libraries.

This is a much more heavyweight change, and its not a clear win.  Yes I agree that in some ways it's strange to enforce a total order between unrelated things, but on the other hand it's very convenient, and easy to understand.

Currently the default fixity is infixl 9.  That is, if you don't declare a fixity, you automatically get a fixity that can be used relative to every other operator.  This is quite useful - I bet if we made it mandatory to declare all the relative fixities then we'd need to add fixity declarations to lots of code.  I forsee this being quite tiresome.

If you'd like to make a concrete proposal, then feel free to do so and I'll make sure it gets onto the wiki.


More information about the Haskell-prime mailing list