[Haskell-beginners] annoying precedence of unary negate
magnus at therning.org
Mon Apr 28 04:24:47 UTC 2014
On Sun, Apr 27, 2014 at 10:59:27PM -0500, John M. Dlugosz wrote:
> [ ⋯ , translate (-50) 0 $ color green $ Circle 50 , ⋯]
> The parens around -50 are necessary.
> Is there a more elegant way to write it?
> Without the parens, I don't understand what the compiler sees it as, based
> on the error message. How does the compiler parse it in that case?
It most likely sees it as the binary minus rather than the unary minus.
Magnus Therning OpenPGP: 0xAB4DFBA4
email: magnus at therning.org jabber: magnus at therning.org
twitter: magthe http://therning.org/magnus
The results point out the fragility of programmer expertise: advanced
programmers have strong expectations about what programs should look like,
and when those expectations are violated--in seemingly innocuous
ways--their performance drops drastically.
-- Elliot Soloway and Kate Ehrlich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: not available
More information about the Beginners