Proposals and owners

Simon Marlow marlowsd at gmail.com
Mon Aug 3 05:20:10 EDT 2009


On 02/08/2009 22:38, Niklas Broberg wrote:
>>> I updated the code on the wiki page: the previous version didn't handle
>>> prefix negation - did you implement that yourself in HLint?
>>
>> No, I didn't implement prefix negation in HLint - it never came up as
>> an issue. Perhaps the underlying HSE library dealt with it for me -
>> Niklas would know.
>
> In haskell-src-exts (and haskell-src, since that's inherited), unary
> minus binds tighter than any infix operator:
>
>> exp0b :: { PExp }
>>        : exp0b qop exp10b              { InfixApp $1 $2 $3 }
>>        | dvarexp                       { $1 }
>>        | exp10b                        { $1 }
>
>> exp10b :: { PExp }
>>        : 'case' exp 'of' altslist      { Case $2 $4 }
>>        | '-' fexp                      { NegApp $2 }
>>        | 'do' stmtlist                 { Do $2 }
>>        | 'mdo' stmtlist                { MDo $2 }
>>        | fexp                          { $1 }
>
> It has never come up as a problem. Guess that's a point in case for
> getting rid of unary minus as an operator. :-)

I think someone should propose this change for next year's Haskell 
revision.  We have evidence that (a) the current precedence of prefix 
negation is confusing, and (b) it is rarely relied upon.

Changing the syntax as above is better IMO than the suggestion in

http://hackage.haskell.org/trac/haskell-prime/wiki/NegativeSyntax

to move prefix negation into the lexical syntax of numbers.

Cheers,
	Simon


More information about the Haskell-prime mailing list