Extend defaulting plugin API to allow defaulting on multi-parameter type classes
Currently, the defaulting plugin API matches exactly the signature of the built-in defaulting mechanism, where each type variable occuring in the `Wanteds` can be proposed to be defaulted to a priority list of types, one by one, with some extra constraints that need to hold after defaulting.
Since each new constraint is associated with a single defaultable type variable, this makes it impossible to propose defaults for multi-parameter typeclasses `C a b`, or even constraints with multiple as-yet-unsolved type variables`C (T a b)`.
However, it would not take much to extend the plugin API to support this use case. I have a prototype implementation at https://gitlab.haskell.org/cactus/ghc/-/commit/b73d407b20c2ba8c0792855b41d1b5dd5dc1aee5 that changes the API to this:
```
data DefaultingProposal
= DefaultingProposal
{ deProposalTyVars :: [TcTyVar]
-- ^ The type variable to default.
, deProposalCandidates :: [[Type]]
-- ^ Candidate types to default the type variable to.
, deProposalCts :: [Ct]
-- ^ The constraints against which defaults are checked.
}
```
The types could be a bit tighter, because basically we want a rectangle of proposal candidates (`all (equalLength deProposalTyVars) deProposalCandidates`), but I don't know how that's usually done in the GHC codebase so for the prototype this shall do.
issue