Solved: Typing problems with polymorphic recursion and typeclasses

Simon Peyton-Jones simonpj@microsoft.com
Wed, 7 May 2003 09:02:20 +0100


| I admit I'm confused: can I compose a type expression that describes
| the type of h? For example, I plan to document the function h and want
| to give its type signature. I don't know what to write. We know that
| "(Show fa) =3D> t -> fa" is not it: it's too polymorphic. Is there any
| type expression that is polymorphic just enough?

It's only "too polymorphic" at the recursive call. You can make that
call use a more specific type, using lexically scoped type variables, as
has been suggested earlier in this thread. Then you can certainly have a
type signature for 'h', as polymorphic as you please.

Simon