[Haskell-cafe] Solved but strange error in type inference

Yucheng Zhang yczhang89 at gmail.com
Wed Jan 4 13:15:54 CET 2012

On Wed, Jan 4, 2012 at 7:58 PM, Yves Parès <limestrael at gmail.com> wrote:
> f :: forall a. a -> a
> f x = x :: forall a. a
> Which is obviously wrong: when you have entered f, x has been instatiated to
> a specific type 'a', and then you want it to x to be of any type? That
> doesn't make sense.

I did not expect the type variables to be scoped.

I expected the type of 'x' to be universally quantified, and thus can be unified
with 'forall a. a' with no problem.

More information about the Haskell-Cafe mailing list