Skip to content

Prioritise nominal equalities

Simon Peyton Jones requested to merge wip/T24887 into master

The main payload of this patch is

  • Prioritise nominal equalities in the constraint solver. This ameliorates the incompleteness of solving for representational constraints over newtypes: see #24887 (closed).

    See (EX2) in Note [Decomposing newtype equalities] in GHC.Tc.Solver.Equality

In doing this patch I tripped over some other things that I refactored:

  • Move isCoVarType from GHC.Core.Type to GHC.Core.Predicate where it seems more at home.

  • Clarify the "rewrite role" of a constraint. I was very puzzled about what the role of, say (Eq a) might be, but see the new Note [The rewrite-role of a constraint].

    In doing so I made predTypeEqRel crash when given a non-equality. Usually it expects an equality; but it was being mis-used for the above rewrite-role stuff.

Merge request reports