On Wed, Jan 4, 2012 at 08:41, Yves Parès <limestrael@gmail.com> wrote:
Would you try:

f :: a -> a
f x = undefined :: a

And tell me if it works? IMO it doesn't.

It won't; a will be a new type variable unrelated to the one in the signature, in the absence of ScopedTypeVariables and an explicit forall in the signature.

As I understand it, without ScopedTypeVariables the scope of type variables in the signature is exactly the signature; with ScopedTypeVariables *and* an explicit forall, the scope includes the equation.

Also, I should mention that the extensions-free way to do this kind of thing is judicious use of asTypeOf.

--
brandon s allbery                                      allbery.b@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms