[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell
Subject:    v1.1 bug in example with prefix - (SYNTAX ONLY)
From:       haskell-request () dcs ! glasgow ! ac ! uk
Date:       1991-08-29 0:25:59
Message-ID: 9108281704.AA05462 () animal ! cs ! chalmers ! se
[Download RAW message or body]

From: haskell-request@dcs.glasgow.ac.uk
Date: 29 Aug 91  0:48
Sender: Mikael Rittri <rittri>
To: haskell@dcs.glasgow.ac.uk
Subject: v1.1 bug in example with prefix - (SYNTAX ONLY)

Original-Via: uk.ac.ukc; Thu, 29 Aug 91 00:54:04 BST
Original-Sender: rittri%se.chalmers.cs@sunic.sunet.se

Page 60, line 9, says

        -13 `mod` 4 == 3,

but page 12, line 1, says

        "[negation] has the same precedence as the infix - operator"

so
        -13 `mod` 4

is parsed as

        - (13 `mod` 4)

which is -3.


Comments (for version 1.2?):
The precedence change of prefix - is important and should have been
mentioned in the lists of syntactic changes on page iii and appendix B.2.
It should also be emphasized in section 3.2, which now only says
that  -e  is equivalent to  negate(e) ; the extra parentheses
do not resolve how far  e  extends. 

        -- Sorry,
                Mikael

P.S.  Nowadays, I think the precedence of prefix - should be *between*
the additive and multiplicative operators, which unfortunately
is 6 1/2.  But a similar effect could be achieved by letting it
have precedence 7 and be left-associative.




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic