[Haskell-cafe] GHC Feature or Bug: f x = (`head` x, ())

Jeremy Shaw jeremy at n-heptane.com
Tue Aug 5 13:01:23 EDT 2008


GHC is happy to compile this code:

> f x = (`head` x, ())

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 mailing list