Inferred type is less polymorphic than expected?

Thomas Jäger thjaeger at gmail.com
Fri Jul 29 21:54:16 EDT 2005


Hi,

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).

Thomas

On 7/29/05, Benjamin Franksen <benjamin.franksen at bessy.de> wrote:
> a connection to the first one? Note, I have a version of the program,
> where I only get the "Inferred type is less polymorphic than expected"
> error message and this one also disappears as soon as I use a lambda
> instead of a top-level function to initialize the record.
> 
> Ben


More information about the Glasgow-haskell-users mailing list