Fixity declarations

Wolfgang Lux [email protected]
Thu, 12 Jul 2001 18:26:18 +0200


Koen Claessen wrote

> However, it is not possible to define the fixity of an
> operator which is an argument to a function. If I define:
> 
>   foldr4 :: (a -> b -> b) -> b -> (a,a,a,a) -> b
>   foldr4 (#) z (a,b,c,d) = a # b # c # d # z
> 
> I will have to put in parentheses explicitly, because it is
> not possible to define the fixity of that entity (namely the
> argument (#) to foldr4).
> 
> In this case, (#) gets the default fixity, namely infixl 9.
> 
> Apart from the fact if we want to allow this or not, I think
> the report should be clear about that it is not possible to
> define the fixities of locally bound operator names in this
> way.

Hmmm, unless I overlooked something your example is syntacally not 
valid by the grammar given in appendix B.4 of the Haskell 98 report.
Operators in patterns can be used only with an infix syntax.

Wolfgang


--
Wolfgang Lux				  Phone: +49-251-83-38263
Institut fuer Wirtschaftinformatik	    FAX: +49-251-83-38259
Universitaet Muenster		      Email: [email protected]