Skip to content

Draft: implement the new generalisation defaulting plan

sheaf requested to merge sheaf/ghc:T20686 into master

I'm putting up this early draft for discussion only; it's far from being correct at the moment.

The main idea is that I am implementing the plan described in #20686 by refactoring GHC.Tc.Solver.decideQuantification.

Overview:

  • GHC.Tc.Solver.decideQuantification has been rewritten to follow the design of #20686.
  • GHC.Tc.Solver.decideQuantifiedTyVars collects up variables for promotion and defaulting as described in the plan.
  • GHC.Tc.Utils.TcMType.collectComponentTyVars finds the kind, RuntimeRep and multiplicity components. It's meant to replace collect_cand_qtvs, but I haven't removed the old functions yet.
  • GHC.Tc.Solver.quantifiableCt re-implements pickQuantifiablePreds in a way that is more appropriate for the new defaulting plan where we only decide on which variables to quantify over at the end.

TODO:

  • Update Notes referring to decidePromotedTyVars and defaultTyVarsAndSimplify.
Edited by sheaf

Merge request reports