Note [Pattern bindings and complete signatures]
Consider
data T a = MkT a a
f :: forall a. a->a
g :: forall b. b->b
MkT f g = MkT (\x->x) (\y->y)
Here we'll infer a type from the pattern of 'T a', but if we feed in
the signature types for f and g, we'll end up unifying 'a' and 'b'
So we instantiate f and g's signature with TyVarTv skolems
(newMetaTyVarTyVars) that can unify with each other. If too much
unification takes place, we'll find out when we do the final
impedance-matching check in GHC.Tc.Gen.Bind.mkExport
See Note [TyVarTv] in GHC.Tc.Utils.TcMType
None of this applies to a function binding with a complete
signature, which doesn't use tcInstSig. See GHC.Tc.Gen.Bind.tcPolyCheck. References 1
- TyVarTv GHC.Tc.Utils.TcMType
Referenced by 1
- GHC.Tc.Gen.Sig call site