[Haskell-cafe] Re: GHC Feature or Bug: f x = (`head` x, ())
Christian.Maeder at dfki.de
Wed Aug 6 08:40:46 EDT 2008
Jeremy Shaw wrote:
> GHC is happy to compile this code:
>> f x = (`head` x, ())
(+ x, ())
((), + x)
((), + x, ())
are accepted by GHC
This looks like a bug to me, because
((), x +)
Sections need to be in parens.
If one allows sections as tuple components, then the latter should may
be made legal, too.
> but Hugs does not like it, and Section 3.5 of the Haskell Report does
> not give any obvious indications that it is valid. Numerous people
> have suggested that some additional parens are required:
>> f x = ((`head` x), ())
> Is this GHC behavior intentional? If not, is it perhaps a happy
> accident? Or is it ambigious in some way with out the additional
> parenthesis ?
> I am curious because trhsx (the preprocessor for HSP/HSX) currently
> does not accept this construct. If it is a bug in GHC (that will
> eventually be fixed), then we can leave trhsx alone. If it is a
> feature, then a precise definition of the adjusted syntax would be
> helpful. (Or, if this construct is valid H98, an explaination of how
> to read the report correctly).
More information about the Haskell-Cafe