Re: Negation

2010-02-14 Thread Simon Marlow
On 14/02/10 02:21, Lennart Augustsson wrote: I agree, I don't think this is a bug. If the grammar actually says that this is legal, then I think the grammar is wrong. As far as I can tell Doitse is correct in that GHC does not implement the grammar, so it's either a bug in GHC or the

Re: Negation

2010-02-14 Thread Atze Dijkstra
In UHC it was unpleasant to make it work, because in (e) and (e +) it only is detected just before the closing parenthesis which of the two alternatives (i.e. parenthesized or sectioned expression) must be chosen. The use of LL parsing aggravates this somewhat, so the required

Re: Negation

2010-02-14 Thread S. Doaitse Swierstra
On 14 feb 2010, at 09:32, Simon Marlow wrote: On 14/02/10 02:21, Lennart Augustsson wrote: I agree, I don't think this is a bug. If the grammar actually says that this is legal, then I think the grammar is wrong. As far as I can tell Doitse is correct in that GHC does not implement the

Re: Negation

2010-02-13 Thread Simon Marlow
On 10/02/10 07:53, Atze Dijkstra wrote: On 10 Feb, 2010, at 00:53 , Lennart Augustsson wrote: Do you deal with this correctly as well: case () of _ - 1==1==True No, that is, in the same way as GHC Hugs, by reporting an error. Note that Haskell 2010 now specifies that expression to be a

Re: Negation

2010-02-13 Thread Simon Marlow
On 09/02/10 21:43, S. Doaitse Swierstra wrote: One we start discussing syntax again it might be a good occasion to reformulate/make more precise a few points. The following program is accepted by the Utrecht Haskell Compiler (here we took great effort to follow the report closely ;-} instead of

Re: Negation

2010-02-13 Thread John Launchbury
I don't think this is a bug. I do not expect to be able to unfold a definition without some syntactic issues. For example, two = 1+1 four = 2 * two but unfolding fails (four = 2 * 1 + 1). In general, we expect to have to parenthesize things when unfolding them. John On Feb 13, 2010, at

Re: Negation

2010-02-13 Thread Lennart Augustsson
I agree, I don't think this is a bug. If the grammar actually says that this is legal, then I think the grammar is wrong. On Sun, Feb 14, 2010 at 1:48 AM, John Launchbury j...@galois.com wrote: I don't think this is a bug. I do not expect to be able to unfold a definition without some

Re: Negation

2010-02-13 Thread Ian Lynagh
On Sun, Feb 14, 2010 at 03:21:54AM +0100, Lennart Augustsson wrote: I agree, I don't think this is a bug. If the grammar actually says that this is legal, then I think the grammar is wrong. Then what do you think the grammar should say instead? That sections should be ( fexp qop ) ? I've

Re: Negation

2010-02-11 Thread John D. Earle
1443 To: Haskell Prime haskell-prime@haskell.org Subject: Re: Negation One we start discussing syntax again it might be a good occasion to reformulate/make more precise a few points. The following program is accepted by the Utrecht Haskell Compiler (here we took great effort to follow the report

Re: Negation

2010-02-10 Thread Sebastian Fischer
On Feb 9, 2010, at 10:43 PM, S. Doaitse Swierstra wrote: -- but if we now unfold the definition of one we get a parser error in GHC increment' = ( let x=1 in x + ) The GHC and Hugs parsers are trying so hard to adhere to the meta rule that bodies of let-expressions extend as far as

RE: Negation

2010-02-09 Thread Sittampalam, Ganesh
Lennart Augustsson wrote: Of course unary minus should bind tighter than any infix operator. I remember suggesting this when the language was designed, but the Haskell committee was very set against it (mostly Joe Fasel I think). Are there archives of this discussion anywhere? Cheers,

Re: Negation

2010-02-09 Thread Jon Fairbairn
Sittampalam, Ganesh ganesh.sittampa...@credit-suisse.com writes: Lennart Augustsson wrote: Of course unary minus should bind tighter than any infix operator. I remember suggesting this when the language was designed, but the Haskell committee was very set against it (mostly Joe Fasel I

Re: Negation

2010-02-09 Thread Lennart Augustsson
It's not true at all that Haskell was created by type theorists. It is true that little attention was paid for how things are done in C. :) On Tue, Feb 9, 2010 at 2:39 PM, johndea...@cox.net wrote: It needs to be appreciated that the Haskell language was created by type theorists who were

Re: Negation

2010-02-09 Thread Christian Maeder
| I imagine it would be something like deleting the production | | lexp6- - exp7 The rational for the current choice was the example: f x = -x^2 | and adding the production | | exp10- - fexp But I would also recommend this change. It would also make sense to

Re: Negation

2010-02-09 Thread johndearle
My impression is that combinatory logic figures prominently in the design of Haskell and some of the constructs seem to be best understood as combinatorial logic with syntactic sugar. One could predict from this a number of things. One of such is the language would at some points seem counter

Re: Negation

2010-02-09 Thread S. Doaitse Swierstra
One we start discussing syntax again it might be a good occasion to reformulate/make more precise a few points. The following program is accepted by the Utrecht Haskell Compiler (here we took great effort to follow the report closely ;-} instead of spending our time on n+k patterns), but

Re: Negation

2010-02-09 Thread Lennart Augustsson
Do you deal with this correctly as well: case () of _ - 1==1==True On Tue, Feb 9, 2010 at 10:43 PM, S. Doaitse Swierstra doai...@cs.uu.nl wrote: One we start discussing syntax again it might be a good occasion to reformulate/make more precise a few points. The following program is accepted

Re: Negation

2010-02-09 Thread Atze Dijkstra
On 10 Feb, 2010, at 00:53 , Lennart Augustsson wrote: Do you deal with this correctly as well: case () of _ - 1==1==True No, that is, in the same way as GHC Hugs, by reporting an error. The report acknowledges that compilers may not deal with this correctly when it has the form ``let

Re: Negation

2010-02-08 Thread Dan Doel
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

Re: Negation

2010-02-08 Thread Ross Paterson
On Mon, Feb 08, 2010 at 04:18:07PM +, Simon Peyton-Jones wrote: Which of these definitions are correct Haskell? x1 = 4 + -5 x2 = -4 + 5 x3 = 4 - -5 x4 = -4 - 5 x5 = 4 * -5 x6 = -4 * 5 Ghc accepts x2, x4, x6 and rejects the others with a message like Foo.hs:4:7:

Re: Negation

2010-02-08 Thread Ian Lynagh
On Mon, Feb 08, 2010 at 04:59:59PM +, Ross Paterson wrote: But I agree they should all be legal, i.e. that unary minus should bind more tightly than any infix operator (as in C). See also http://hackage.haskell.org/trac/haskell-prime/wiki/NegativeSyntax Thanks Ian

Re: Negation

2010-02-08 Thread Sjur Gjøstein Karevoll
Måndag 8. februar 2010 17.59.59 skreiv Ross Paterson: But I agree they should all be legal, i.e. that unary minus should bind more tightly than any infix operator (as in C). I second this, at least in general. However, one issue is function application. Should unary minus bind tighter than it

Re: Negation

2010-02-08 Thread Lennart Augustsson
Of course unary minus should bind tighter than any infix operator. I remember suggesting this when the language was designed, but the Haskell committee was very set against it (mostly Joe Fasel I think). I think it's too late to change that now, it could really introduce some subtle bugs with no

Re: Negation

2010-02-08 Thread John Meacham
On Mon, Feb 08, 2010 at 04:18:07PM +, Simon Peyton-Jones wrote: Which of these definitions are correct Haskell? x1 = 4 + -5 x2 = -4 + 5 x3 = 4 - -5 x4 = -4 - 5 x5 = 4 * -5 x6 = -4 * 5 Ghc accepts x2, x4, x6 and rejects the others with a message like Foo.hs:4:7:

Re: Negation

2010-02-08 Thread Ross Paterson
On Mon, Feb 08, 2010 at 01:24:55PM -0800, John Meacham wrote: What would be the actual change proposed? If it is something concrete and not something like negatives should be interpreted as unary minus when otherwise it would lead to a parse error then that wouldn't be good. I have enough

RE: Negation

2010-02-08 Thread Simon Peyton-Jones
| Of course unary minus should bind tighter than any infix operator. | I remember suggesting this when the language was designed, but the | Haskell committee was very set against it (mostly Joe Fasel I think). | | I think it's too late to change that now, it could really introduce | some subtle