Commit 483eeba4 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Comments only

parent a736b517
......@@ -813,9 +813,10 @@ flattenExactFamApp_fully fmode tc tys
flattenTyVar :: FlattenEnv -> TcTyVar -> TcS (Xi, TcCoercion)
-- "Flattening" a type variable means to apply the substitution to it
-- The substitution is actually the union of the substitution in the TyBinds
-- for the unification variables that have been unified already with the inert
-- equalities, see Note [Spontaneously solved in TyBinds] in TcInteract.
-- The substitution is actually the union of
-- * the unifications that have taken place (either before the
-- solver started, or in TcInteract.solveByUnification)
-- * the CTyEqCans held in the inert set
-- Postcondition: co : xi ~ tv
flattenTyVar fmode tv
......@@ -761,8 +761,8 @@ solveByUnification :: CtEvidence -> TcTyVar -> Xi -> TcS ()
-- say that in (a ~ xi), the type variable a does not appear in xi.
-- See TcRnTypes.Ct invariants.
-- Post: tv ~ xi is now in TyBinds, no need to put in inerts as well
-- see Note [Spontaneously solved in TyBinds]
-- Post: tv is unified (by side effect) with xi;
-- we often write tv := xi
solveByUnification wd tv xi
= do { let tv_ty = mkTyVarTy tv
; traceTcS "Sneaky unification:" $
......@@ -793,21 +793,6 @@ ppr_kicked 0 = empty
ppr_kicked n = parens (int n <+> ptext (sLit "kicked out"))
Note [Spontaneously solved in TyBinds]
When we encounter a constraint ([W] alpha ~ tau) which can be spontaneously solved,
we record the equality on the TyBinds of the TcSMonad. In the past, we used to also
add a /given/ version of the constraint ([G] alpha ~ tau) to the inert
canonicals -- and potentially kick out other equalities that mention alpha.
Then, the flattener only had to look in the inert equalities during flattening of a
type (TcCanonical.flattenTyVar).
However it is a bit silly to record these equalities /both/ in the inerts AND the
TyBinds, so we have now eliminated spontaneously solved equalities from the inerts,
and only record them in the TyBinds of the TcS monad. The flattener is now consulting
these binds /and/ the inerts for potentially unsolved or other given equalities.
kickOutRewritable :: CtEvidence -- Flavour of the equality that is
-- being added to the inert set
......@@ -379,8 +379,6 @@ Type-family equations, of form (ev : F tys ~ ty), live in three places
data InertCans
= IC { inert_eqs :: TyVarEnv EqualCtList
-- All CTyEqCans; index is the LHS tyvar
-- Some Refl equalities are also in tcs_ty_binds
-- see Note [Spontaneously solved in TyBinds] in TcInteract
, inert_funeqs :: FunEqMap Ct
-- All CFunEqCans; index is the whole family head type.
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