Note [Remove redundant provided dicts]
Recall that
HRefl :: forall k1 k2 (a1:k1) (a2:k2). (k1 ~ k2, a1 ~ a2)
=> a1 :~~: a2
(NB: technically the (k1~k2) existential dictionary is not necessary,
but it's there at the moment.)
Now consider (#14394):
pattern Foo = HRefl
in a non-poly-kinded module. We don't want to get
pattern Foo :: () => (* ~ *, b ~ a) => a :~~: b
with that redundant (* ~ *). We'd like to remove it; hence the call to
mkMinimalWithSCs.
Similarly consider
data S a where { MkS :: Ord a => a -> S a }
pattern Bam x y <- (MkS (x::a), MkS (y::a)))
The pattern (Bam x y) binds two (Ord a) dictionaries, but we only
need one. Again mkMimimalWithSCs removes the redundant one. References 0
This Note does not link to any other.
Referenced by 4
- GHC.Tc.Utils.TcType call site ×2
- Suppress redundant givens during error reporting GHC.Tc.Errors
- GHC.Tc.TyCl.PatSyn call site