> if I write
>
> (a &&& b) x = a x && b x
>
> hugs accepts it, but ghc rejects it. I think that ghc is correct in
> that the report only allows
>
> funlhs
> ->
> var apat {apat }
> |
> pati+1 varop(a,i) pati+1
> |
> lpati varop(l,i) pati+1
> |
> pati+1 varop(r,i) rpati
>
> ie no () and no extra arguments, but given that one may want to define
> higher order functions this way, we ought to make the language allow it.
>
> Can anyone argue against it?
No, I have been bitten by this restriction several times (I even sent
a similar script as a bug to glasgow-bugs). On page 90 of the Haskell
Report we even find
f . g = \ x -> f (g x)
while Miranda TM allows
(f. g) x = f (g x)
Taking Miranda's syntax as a source of inspiration we could
modify funlhs to
funlhs -> var apat {apat}
| pati+1 varop(a,i) pati+1
| lpati varop(l,i) pati+1
| pati+1 varop(r,i) rpati
| pati+1 varop(r,i) rpati
| ( funlhs ) {apat}
Any objections?
Cheers, Ralf