Fixed.
Simon
| -Original Message-
| From: Simon Marlow [mailto:[EMAIL PROTECTED]]
| Sent: 17 May 2002 10:34
| To: Thomas Hallgren; [EMAIL PROTECTED]
| Subject: RE: Negative literals and the meaning of case -2 of
| -2 - True
|
|
|
| To find out how Haskell implementations treat
Thomas Hallgren [EMAIL PROTECTED] writes:
* hugs Dec 2001: main outputs: (FromInteger (-2),True)
* ghc 5.02.2: main outputs: (FromInteger (-2),True)
* hbc 0..5b: main outputs: (Negate (FromInteger 2),False)
* nhc98 1.12: compiler outputs: Fail: What? matchAltIf at 7:13
To find out how Haskell implementations treat negated
literals, I tested
the following program:
main = print (minusTwo,trueOrFalse)
minusTwo = -2::N
trueOrFalse =
case minusTwo of
-2 - True
_ - False
data N =
Hi,
The Haskell report seems pretty clear about the meaning of numeric
literals and negation in expressions: -2 should be interpreted as negate
(fromInteger 2). That is, negated literals are not treated specially,
the general rule -(e) == negate (e) applies. (See section 3.2 and 3.4
of the