- -- Gather type variables to quantify over
- -- and turn them into real TyVars (just as in TcBinds.tcBindWithSigs)
- zonkTcTypes (rule_ty : map idType tpl_ids) `thenNF_Tc` \ zonked_tys ->
- mapTc zonkTcTyVarToTyVar (varSetElems (tyVarsOfTypes zonked_tys)) `thenTc` \ tvs ->
+ -- We initially quantify over any tyvars free in *either* the rule
+ -- *or* the bound variables. The latter is important. Consider
+ -- ss (x,(y,z)) = (x,z)
+ -- RULE: forall v. fst (ss v) = fst v
+ -- The type of the rhs of the rule is just a, but v::(a,(b,c))
+ --
+ -- It's still conceivable that there may be type variables mentioned
+ -- in the LHS, but not in the type of the lhs, nor in the binders.
+ -- They'll get zapped to (), but that's over-constraining really.
+ -- Let's see if we get a problem.
+ forall_tvs = tyVarsOfTypes (rule_ty : map idType tpl_ids)
+ in