Note [Solving CallStack constraints]
See Note [Overview of implicit CallStacks] in GHc.Tc.Types.Evidence.
Suppose f :: HasCallStack => blah. Then
* Each call to 'f' gives rise to
[W] s1 :: IP "callStack" CallStack -- CtOrigin = OccurrenceOf f
with a CtOrigin that says "OccurrenceOf f".
Remember that HasCallStack is just shorthand for
IP "callStack" CallStack
See Note [Overview of implicit CallStacks] in GHC.Tc.Types.Evidence
* We canonicalise such constraints, in GHC.Tc.Solver.Dict.canDictNC, by
pushing the call-site info on the stack, and changing the CtOrigin
to record that has been done.
Bind: s1 = pushCallStack <site-info> s2
[W] s2 :: IP "callStack" CallStack -- CtOrigin = IPOccOrigin
* Then, and only then, we can solve the constraint from an enclosing
Given.
So we must be careful /not/ to solve 's1' from the Givens. We guarantee
this by canonicalising before looking up in the inert set. References 1
- Overview of implicit CallStacks GHC.Tc.Types.Evidence
Referenced by 2
- Call-stack tracing of pattern synonyms GHC.Tc.Gen.Pat
- GHC.Tc.Solver.Dict call site