Note [Orienting TyFamLHS/TyFamLHS]
If we have a TyFamLHS on both sides, we choose how to orient it.
* swap_for_size. If we have
S a ~ F (G (H (Maybe a)))
then we swap so that we tend to rewrite the bigger type (F (G (H (Maybe a))))
into the smaller one (S a). This same test tends to avoid occurs-check
errors. E.g.
S g ~ F (G (S g))
Here (S g) occurs on the RHS, so this is not canonical. But if we swap it
around, it /is/ canonical
F (G (S g)) ~ S g
* swap_for_rewriting: put touchable meta-tyvars on the left:
see Note [Put touchable variables on the left] References 1
- Put touchable variables on the left GHC.Tc.Solver.Equality
Referenced by 3
- GHC.Tc.Solver.Equality call site ×2
- Type equality cycles GHC.Tc.Solver.Equality