Re: parsing differences

1997-08-01 Thread Simon Marlow

Alastair Reid <[EMAIL PROTECTED]> writes:

> Hugs incorrectly allows declarations such as:
> 
> (f `cross` g) (x, y) = (f x , g y) 
> 
> and
> 
> (f.g) x = f (g x)
> 
> because it parses patterns as expressions and then weeds out the things
> that don't make any sense.

To be a little pedantic - ghc also parses patterns as expressions
(necessary due to the non-LRness of the Haskell grammar), but it keeps
track of parentheses in order to implement strange restrictions such
as the above :-)


-- 
Simon Marlow [EMAIL PROTECTED]
University of Glasgow   http://www.dcs.gla.ac.uk/~simonm/
finger for PGP public key



Re: parsing differences

1997-07-31 Thread Alastair Reid


Hugs incorrectly allows declarations such as:

(f `cross` g) (x, y) = (f x , g y) 

and

(f.g) x = f (g x)

because it parses patterns as expressions and then weeds out the things
that don't make any sense.

GHC does a better job of implementing Haskell 1.4 syntax/semantics in this
regard.

Alastair Reid

(That said, I agree that the Hugs approach makes sense and is nicer - but
I don't have the energy to join the Standard Haskell committee and duke
it out with the Big Boys who're busy discussing much more weighty matters.)



parsing differences

1997-07-31 Thread Justin Cormack

Hugs will happily accept definitions such as:
(f `cross` g) (x, y) = (f x , g y)
while ghc gives
parse error on input: "cross"

It is not that ghc doesn't like any definition with `` on the left, as
x `op` y = x + y is fine, it just seems to be cases with brackets.

It is not entirely clear from the language spec whether or not this is valid,
but it does seem more consistent to allow this.

Justin Cormack