monomorphic or not?

John Meacham john at repetae.net
Thu Mar 6 07:03:21 EST 2008


On Thu, Mar 06, 2008 at 11:43:08AM +0000, Simon Peyton-Jones wrote:
> See 4.5.5 in the Report http://haskell.org/onlinereport/decls.html.
> 
> Rule 1 says that 'compress' is not generalised.  So it gets the type
>         [t] -> [t]
> where 'a' is an as-yet-un-determined type; in implementation terms, a unification variable.
> 
> Rule 2 says "Any monomorphic type variables that remain when type inference for an entire module is complete, are considered ambiguous, and are resolved to particular types using the defaulting rules".  But in this case no monomoprhic variables remain, because by then the type of compress has been refined to [Char] -> [Char]

Ah! it all makes sense now. excellent. It has been a persistent
annoyance that jhc gets dinged by the monomorphism restriction more than
ghc, but now I see why. thanks!

        John

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Glasgow-haskell-users mailing list