Note [TcLevel invariants]
* Each unification variable (MetaTv)
and skolem (SkolemTv)
and each Implication
has a level number (of type TcLevel)
* INVARIANT (KindInv) Given a type variable (tv::ki) at at level L,
the free vars of `ki` all have level <= L
* INVARIANTS. In a tree of Implications,
(ImplicInv) The level number (ic_tclvl) of an Implication is
STRICTLY GREATER THAN that of its parent
(SkolInv) The level number of the skolems (ic_skols) of an
Implication is equal to the level of the implication
itself (ic_tclvl)
(GivenInv) The level number of a unification variable appearing
in the 'ic_given' of an implication I should be
STRICTLY LESS THAN the ic_tclvl of I
See Note [GivenInv]
(WantedInv) The level number of a unification variable appearing
in the 'ic_wanted' of an implication I should be
LESS THAN OR EQUAL TO the ic_tclvl of I
See Note [WantedInv]
The level of a MetaTyVar also governs its untouchability. See
Note [Unification preconditions] in GHC.Tc.Utils.Unify.
See also Note [The QLInstVar TcLevel] References 4
- GivenInv GHC.Tc.Utils.TcType
- The QLInstVar TcLevel GHC.Tc.Utils.TcType
- WantedInv GHC.Tc.Utils.TcType
- Unification preconditions GHC.Tc.Utils.Unify
Referenced by 15
- GHC.Tc.Utils.TcType call site ×3
- Promotion in signatures GHC.Tc.Gen.HsType ×2
- Add signature contexts as wanteds GHC.Tc.Solver
- Defaulting during simplifyInfer GHC.Tc.Solver
- GHC.Tc.Solver call site
- Do not unify Givens GHC.Tc.Solver.Equality
- kickOutRewritable GHC.Tc.Solver.InertSet
- GHC.Tc.Solver.InertSet call site
- GHC.Tc.Solver.Solve call site
- GHC.Tc.Types.Constraint call site
- Use level numbers for quantification GHC.Tc.Utils.TcMType
- GHC.Tc.Utils.TcMType call site