[commit: ghc] master: Comments only in TcType (f04f118)
git at git.haskell.org
git at git.haskell.org
Fri Nov 25 11:30:30 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f04f1188ffd39dc3540241cc09c750223f435cc1/ghc
>---------------------------------------------------------------
commit f04f1188ffd39dc3540241cc09c750223f435cc1
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Tue Oct 25 15:25:03 2016 +0100
Comments only in TcType
>---------------------------------------------------------------
f04f1188ffd39dc3540241cc09c750223f435cc1
compiler/typecheck/TcType.hs | 72 +++++++++++++++++++++++---------------------
1 file changed, 38 insertions(+), 34 deletions(-)
diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs
index 4dbe4a3..99927aa 100644
--- a/compiler/typecheck/TcType.hs
+++ b/compiler/typecheck/TcType.hs
@@ -1436,7 +1436,13 @@ tcSplitMethodTy ty
| otherwise
= pprPanic "tcSplitMethodTy" (ppr ty)
------------------------
+
+{- *********************************************************************
+* *
+ Type equalities
+* *
+********************************************************************* -}
+
tcEqKind :: TcKind -> TcKind -> Bool
tcEqKind = tcEqType
@@ -1546,39 +1552,9 @@ pickyEqType ty1 ty2
= isNothing $
tc_eq_type (const Nothing) ty1 ty2
-{- Note [Expanding superclasses]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-When we expand superclasses, we use the following algorithm:
-
-expand( so_far, pred ) returns the transitive superclasses of pred,
- not including pred itself
- 1. If pred is not a class constraint, return empty set
- Otherwise pred = C ts
- 2. If C is in so_far, return empty set (breaks loops)
- 3. Find the immediate superclasses constraints of (C ts)
- 4. For each such sc_pred, return (sc_pred : expand( so_far+C, D ss )
-
-Notice that
-
- * With normal Haskell-98 classes, the loop-detector will never bite,
- so we'll get all the superclasses.
-
- * Since there is only a finite number of distinct classes, expansion
- must terminate.
-
- * The loop breaking is a bit conservative. Notably, a tuple class
- could contain many times without threatening termination:
- (Eq a, (Ord a, Ix a))
- And this is try of any class that we can statically guarantee
- as non-recursive (in some sense). For now, we just make a special
- case for tuples. Somthing better would be cool.
-
-See also TcTyDecls.checkClassCycles.
-
-
-************************************************************************
+{- *********************************************************************
* *
-\subsection{Predicate types}
+ Predicate types
* *
************************************************************************
@@ -1760,7 +1736,35 @@ isImprovementPred ty
ClassPred cls _ -> classHasFds cls
IrredPred {} -> True -- Might have equalities after reduction?
-{-
+{- Note [Expanding superclasses]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+When we expand superclasses, we use the following algorithm:
+
+expand( so_far, pred ) returns the transitive superclasses of pred,
+ not including pred itself
+ 1. If pred is not a class constraint, return empty set
+ Otherwise pred = C ts
+ 2. If C is in so_far, return empty set (breaks loops)
+ 3. Find the immediate superclasses constraints of (C ts)
+ 4. For each such sc_pred, return (sc_pred : expand( so_far+C, D ss )
+
+Notice that
+
+ * With normal Haskell-98 classes, the loop-detector will never bite,
+ so we'll get all the superclasses.
+
+ * Since there is only a finite number of distinct classes, expansion
+ must terminate.
+
+ * The loop breaking is a bit conservative. Notably, a tuple class
+ could contain many times without threatening termination:
+ (Eq a, (Ord a, Ix a))
+ And this is try of any class that we can statically guarantee
+ as non-recursive (in some sense). For now, we just make a special
+ case for tuples. Somthing better would be cool.
+
+See also TcTyDecls.checkClassCycles.
+
Note [Inheriting implicit parameters]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider this:
More information about the ghc-commits
mailing list