Commit 7e0bb82b authored by Ben Gamari's avatar Ben Gamari 🐢 Committed by Marge Bot
Browse files

Add missing Note [Improvement from Ground Wanteds]

Closes #17659.
parent 14bced99
......@@ -543,6 +543,19 @@ mk_strict_superclasses rec_clss ev tvs theta cls tys
= do { sc_ev <- newDerivedNC loc sc_pred
; mk_superclasses rec_clss sc_ev [] [] sc_pred }
{- Note [Improvement from Ground Wanteds]
Suppose class C b a => D a b
and consider
[W] D Int Bool
Is there any point in emitting [D] C Bool Int? No! The only point of
emitting superclass constraints for W/D constraints is to get
improvement, extra unifications that result from functional
dependencies. See Note [Why adding superclasses can help] above.
But no variables means no improvement; case closed.
mk_superclasses :: NameSet -> CtEvidence
-> [TyVar] -> ThetaType -> PredType -> TcS [Ct]
-- Return this constraint, plus its superclasses, if any
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment