Note [Do not unify representational equalities]
Consider [W] alpha ~R# b where alpha is touchable. Should we unify alpha := b? Certainly not! Unifying forces alpha and be to be the same; but they only need to be representationally equal types. For example, we might have another constraint [W] alpha ~# N b where newtype N b = MkN b and we want to get alpha := N b. See also #15144, which was caused by unifying a representational equality. Note that it does however make sense to perform such unifications, as a last resort, when doing top-level defaulting. See Note [Defaulting representational equalities].
References 1
- Defaulting representational equalities GHC.Tc.Solver.Default
Referenced by 3
- Defaulting representational equalities GHC.Tc.Solver.Default
- GHC.Tc.Solver.Equality call site
- GHC.Tc.Utils.Unify call site