[Haskell-cafe] MPTCs and rigid variables

David House dmhouse at gmail.com
Tue Mar 6 17:11:30 EST 2007


On 06/03/07, Simon Peyton-Jones <simonpj at microsoft.com> wrote:
> I'm not against adding "type is too monomorphic" or something like that if you think it'd help, but I'd like to say something about the incompatibility of 'a' and 'Int'.  No?

Here's a proper draft, then.

Foo.hs:
foo :: [a] -- line 1
foo = "hello" -- line 2

Error message:
Inferred type is not as polymorphic as type signature claims.
  Inferred type: [Char]
  Expected type: [a]
    Provided by the type signature:
      foo :: [a]
    at ~/foo.hs:1
(`a', a polymorphic type variable, could not be unified with `Char', a
monotype.)
In the expression: "hello" at ~/foo.hs:1:8
In the definition of `foo': foo = "hello"

How's that sound?

-- 
-David House, dmhouse at gmail.com


More information about the Haskell-Cafe mailing list