prefix minus and infix resolution

Cale Gibbard cgibbard at gmail.com
Thu Jul 15 06:09:21 EDT 2010


I'd just like to remark that I think the current behaviour is the  
right thing to do with respect to -x^2. Negation is related to  
addition and so should always bind more weakly than multiplicative  
operations.

- Cale

On 2010-07-15, at 4:31, Christian Maeder <Christian.Maeder at dfki.de>  
wrote:

> Hi Atze,
>
> I share your desire for simplicity. In fact, I think my proposal is
> simpler than the existing ones of hugs, ghc, nhc98 and the language
> descriptions (98, 2010), although it's basically a matter of tuning.
>
> Layout and the type system are far more involving and should not
> interfere with fixity resolution!
>
> Simon said somewhere that fixity resolution takes basically 12 lines  
> of
> haskell code. (My algorithm has 40 but shorter ones.)
>
> Furthermore, fixity resolution is a nice subject for teaching in
> conjunction with expression evaluation.
>
> I added a remark to the end of
> http://hackage.haskell.org/trac/haskell-prime/wiki/PrefixMinusResolution
> about rejecting prefix minus applications that do not bind tightly. It
> would use the same resolution algorithm with one modified line.
>
> It says: reject "- 1 ^ 2" always without parens in order to avoid the
> too simple (wrong) resolution as "(- 1) ^ 2".
>
> C.


More information about the Haskell-prime mailing list