GHC's parser is more accepting than Haskell2010 for function bindings
If I say
{-# LANGUAGE Haskell2010 #-}
module Bug where
((f x)) y = x + y
GHC succeeds. This appears to go against the Haskell 2010 Report, Section 4.4.3:
decl → (funlhs | pat) rhs
funlhs → var apat { apat }
| pat varop pat
| '(' funlhs ')' apat { apat }
rhs → = exp [where decls]
| gdrhs [where decls]
Note that a funlhs
is allowed to have parentheses, but there must be an apat
after the )
. My example above has a )
after the )
, and yet is accepted.
Similarly
(f) x y = x + y
is accepted, despite having no apat
s within the parentheses.
I propose to continue accepting this syntax, but to document this as a deviation from the standard.