higher-kind deriving ... or not

Tom Pledger Tom.Pledger@peace.com
Wed, 27 Feb 2002 08:59:26 +1300


C T McBride writes:
 :
 | A little more tinkering, and it looks like it might be
 | 
 |   show :: Show (f (Wonky f)) => Wonky f -> String
 | 
 | Is this really the type of show?

That looks correct to me.

 | If so, no wonder there's a problem.

Yes, there's a vicious circle in context reduction, between Wonky Copy
and Copy (Wonky Copy).

 | I don't want to start an argument about how to solve this problem.  I
 | do want to suggest that, for the time being, it would be better to
 | reject `deriving Show' for type constructors like Wonky (ie those with
 | higher-kind parameters) than to generate instances which break the
 | compiler.
 | 
 | Or am I just being a spoilsport?

It depends on your definition of sport.  ;-)

> data Sport f
>   = Sport
>   | Association (f Bool)
>   deriving Show

> test = show (Sport :: Sport Maybe)

Regards,
Tom