[commit: ghc] master: Comments only (483eeba)

git at git.haskell.org git at git.haskell.org
Tue Nov 18 22:27:03 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/483eeba47c8f761e5a0913c37823b640a624c6fb/ghc

>---------------------------------------------------------------

commit 483eeba47c8f761e5a0913c37823b640a624c6fb
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Nov 18 22:27:01 2014 +0000

    Comments only


>---------------------------------------------------------------

483eeba47c8f761e5a0913c37823b640a624c6fb
 compiler/typecheck/TcFlatten.lhs  |  7 ++++---
 compiler/typecheck/TcInteract.lhs | 19 ++-----------------
 compiler/typecheck/TcSMonad.lhs   |  2 --
 3 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/compiler/typecheck/TcFlatten.lhs b/compiler/typecheck/TcFlatten.lhs
index 2e9c6eb..2d41ff8 100644
--- a/compiler/typecheck/TcFlatten.lhs
+++ b/compiler/typecheck/TcFlatten.lhs
@@ -813,9 +813,10 @@ flattenExactFamApp_fully fmode tc tys
 \begin{code}
 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
diff --git a/compiler/typecheck/TcInteract.lhs b/compiler/typecheck/TcInteract.lhs
index 3501a99..6a3eca4 100644
--- a/compiler/typecheck/TcInteract.lhs
+++ b/compiler/typecheck/TcInteract.lhs
@@ -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"))
 \end{code}
 
-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.
-
 \begin{code}
 kickOutRewritable :: CtEvidence   -- Flavour of the equality that is
                                   -- being added to the inert set
diff --git a/compiler/typecheck/TcSMonad.lhs b/compiler/typecheck/TcSMonad.lhs
index cd778cf..d4a5a9a 100644
--- a/compiler/typecheck/TcSMonad.lhs
+++ b/compiler/typecheck/TcSMonad.lhs
@@ -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.



More information about the ghc-commits mailing list