Inferred type is less polymorphic than expected?

Benjamin Franksen benjamin.franksen at
Sat Jul 30 08:27:53 EDT 2005

On Saturday 30 July 2005 03:54, Thomas Jäger wrote:
> You're probably refering to the version where you omit the type
> signatures of both 'printer' and 'printCatalog'. Here the situation
> is different because the compiler needs to infer the types and not
> just check. In the explicitely typed version, 'printCatalog' is used
> polymorphically, i.e. the 'c' is instantiated to different types
> during the recursive call. Thus the example needs polymorphic
> recursion, for which type inference is known to be undecidable. It is 
> therefore reasonable that ghc (as well as hugs) can't compile the
> code (in fact, I guess type inference will assume that both contexts
> are equal).

Hmm. I am not sure I understand this.

Are you saying, that the second error causes the first one? Thus, 
everything is caused by 'printer' being recursively defined?

Are contexts with differing length in a recursive definition ok in Hugs 
(as in the latest version of ghc) and therefore with Hugs I don't get 
the first message either?


More information about the Glasgow-haskell-users mailing list