Skip to content

Decompose TyConApps more carefully

Simon Peyton Jones requested to merge wip/T22331 into master

Ticket #22331 (closed) showed that we were being too eager to decompose a Wanted TyConApp, leading to incompleteness in the solver.

To understand all this I ended up doing a substantial rewrite of the old Note [Decomposing equalities], now reborn as Note [Decomposing TyConApp equalities]. Plus rewrites of other related Notes.

The actual fix is very minor and actually simplifies the code: in can_decompose in GHC.Tc.Solver.Canonical.canTyConApp, we now call noMatchableIrreds. A closely related refactor: we stop trying to use the same "no matchable givens" function here as in matchClassInst. Instead split into two much simpler functions.

Edited by Simon Peyton Jones

Merge request reports