Negation
Dan Doel
dan.doel at gmail.com
Mon Feb 8 12:00:52 EST 2010
On Monday 08 February 2010 11:18:07 am Simon Peyton-Jones wrote:
> I think that Hugs is right here. After all, there is no ambiguity in any
> of these expressions. And an application-domain user found this behaviour
> very surprising.
I think it's clear what one would expect the result of these expressions to
be, but there is some ambiguity considering how GHC parses other similar
expressions (I don't actually know if it's following the report in doing so or
not). For instance:
-4 `mod` 5
parses as:
-(4 `mod` 5)
which I've seen confuse many a person (and it confused me the first time I saw
it; it makes divMod and quotRem appear identical if one is testing them by
hand as above, and doesn't know about the weird parsing). Knowing the above, I
wasn't entirely sure what the results of x2 and x4 would be.
Of course, I think the `mod` parsing is the weird bit, and it'd be good if it
could be amended such that
-a `mod` -b = (-a) `mod` (-b)
like the rest of the proposal.
-- Dan
More information about the Haskell-prime
mailing list