[Haskell-cafe] Why distinct tyvars in instance declarations?

Frank-Andre Riess riess at informatik.uni-muenchen.de
Mon Jun 27 11:36:17 EDT 2005


Hi there,

> but GHC complains:
> >     Illegal instance declaration for `Foo (Either b b)'
> >         (The instance type must be of form (T a b c)
> >          where T is not a synonym, and a,b,c are distinct type variables)
> >     In the instance declaration for `Foo (Either b b)'

unless I'm totally mistaken, your problem isn't the distinction thingy, but 
rather an error like supplying an Int for where you need (Int -> Int -> Int). 
That is, you're trying make (Either String String) an instance of Foo, 
(Either String String) already being a fully constructed type; Foo, on the 
other hand, seems to require a type constructor that is yet to parameterize 
over three more types (e.g. StateT).

Greets,
Frank-Andre Riess


More information about the Haskell-Cafe mailing list