RE: Negative literals and the meaning of case -2 of -2 - True

2002-05-27 Thread Simon Peyton-Jones
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

Re: Negative literals and the meaning of case -2 of -2 - True

2002-05-20 Thread Malcolm Wallace
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

RE: Negative literals and the meaning of case -2 of -2 - True

2002-05-17 Thread Simon Marlow
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 =

Negative literals and the meaning of case -2 of -2 - True

2002-05-16 Thread Thomas Hallgren
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