instance inference

Ross Paterson ross at
Mon Feb 6 08:00:14 EST 2006

On Mon, Feb 06, 2006 at 01:53:17PM +0100, Doaitse Swierstra wrote:
> I have not followed this completely, but do these new rules now allow:
> class F a b c where
>   f: a -> b -> c
> and then
> instance F a a a where

Yes.  Indeed they allow any unconstrained instance.  They would
also allow

	instance C a a => F a a a

> On the other hand:
> instance F [a] [a] [a] where
>  ...
> posed no problem, although I still see no non-type-variable in the  
> head, or is [] a non-type-variable? I assumed the complaint was a  
> left-over from the single parameter classes, where indeed having a  
> single variable in an instance declaration does not make much sense.  
> The second example does not follow the old rule (2) below!

The argument [a] is not a type variable, so this is OK under the old
rule (2).

More information about the Glasgow-haskell-users mailing list