Note [Simplifiable given constraints]
A type signature like f :: Eq [(a,b)] => a -> b is very fragile, for reasons described at length in GHC.Tc.Solver.Dict Note [Instance and Given overlap]. As that Note discusses, for the most part the clever stuff in GHC.Tc.Solver.Dict means that we don't use a top-level instance if a local Given might fire, so there is no fragility. But if we /infer/ the type of a local let-binding, things can go wrong (#11948 is an example, discussed in the Note). So this warning is switched on only if we have NoMonoLocalBinds; in that case the warning discourages users from writing simplifiable class constraints. The warning only fires if the constraint in the signature matches the top-level instances in only one way, and with no unifiers -- that is, under the same circumstances that GHC.Tc.Instance.Class.matchInstEnv fires an interaction with the top level instances. For example (#13526), consider instance {-# OVERLAPPABLE #
References 1
- Instance and Given overlap GHC.Tc.Solver.Dict
Referenced by 2
- Instance and Given overlap GHC.Tc.Solver.Dict
- GHC.Tc.Validity call site