[commit: ghc] wip/merge-queue: More minor comment improvements (92b684d)

git at git.haskell.org git at git.haskell.org
Sun Jan 13 00:06:06 UTC 2019


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

On branch  : wip/merge-queue
Link       : http://ghc.haskell.org/trac/ghc/changeset/92b684ded87d24b5770f1abd23c07570bbde43db/ghc

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

commit 92b684ded87d24b5770f1abd23c07570bbde43db
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date:   Fri Jan 11 16:42:06 2019 -0500

    More minor comment improvements
    
    [skip ci]


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

92b684ded87d24b5770f1abd23c07570bbde43db
 compiler/types/CoAxiom.hs | 14 ++++----------
 compiler/types/Type.hs    |  6 ++++--
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/compiler/types/CoAxiom.hs b/compiler/types/CoAxiom.hs
index 112ab27..57fb2ef 100644
--- a/compiler/types/CoAxiom.hs
+++ b/compiler/types/CoAxiom.hs
@@ -319,20 +319,14 @@ Note [CoAxBranch type variables]
 In the case of a CoAxBranch of an associated type-family instance,
 we use the *same* type variables (where possible) as the
 enclosing class or instance.  Consider
-   class C a b where
-     type F x b
-     type F [y] b = ...     -- Second param must be b
 
-   instance C Int [z] where
+  instance C Int [z] where
      type F Int [z] = ...   -- Second param must be [z]
 
 In the CoAxBranch in the instance decl (F Int [z]) we use the
 same 'z', so that it's easy to check that that type is the same
 as that in the instance header.
 
-Similarly in the CoAxBranch for the default decl for F in the
-class decl, we use the same 'b' to make the same check easy.
-
 So, unlike FamInsts, there is no expectation that the cab_tvs
 are fresh wrt each other, or any other CoAxBranch.
 
@@ -412,13 +406,13 @@ Now
 For a CoAxBranch for a data family instance with representation
 TyCon rep_tc:
 
-  - cab_tvs of its CoAxiom) may be shorter
+  - cab_tvs (of its CoAxiom) may be shorter
     than tyConTyVars of rep_tc.
 
   - cab_lhs may be shorter than tyConArity of the family tycon
        i.e. LHS is unsaturated
 
-  - cab_rhs will be (rep_tc cab__tvs)
+  - cab_rhs will be (rep_tc cab_tvs)
        i.e. RHS is un-saturated
 
   - This eta reduction happens for data instances as well
@@ -431,7 +425,7 @@ But for a /type/ family
 
 There are certain situations (e.g., pretty-printing) where it is necessary to
 deal with eta-expanded data family instances. For these situations, the
-cab_eta_tvs field records the stuff that has been eta-expanded away.
+cab_eta_tvs field records the stuff that has been eta-reduced away.
 So if we have
     axiom forall a b. F [a->b] = D b a
 and cab_eta_tvs is [p,q], then the original user-written definition
diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs
index 0fff81c..2fd060a 100644
--- a/compiler/types/Type.hs
+++ b/compiler/types/Type.hs
@@ -1389,14 +1389,16 @@ mkLamType v ty
 
 mkLamTypes vs ty = foldr mkLamType ty vs
 
--- | Given a list of type-level vars and a result kind,
+-- | Given a list of type-level vars and the free vars of a result kind,
 -- makes TyCoBinders, preferring anonymous binders
 -- if the variable is, in fact, not dependent.
 -- e.g.    mkTyConBindersPreferAnon [(k:*),(b:k),(c:k)] (k->k)
 -- We want (k:*) Named, (b:k) Anon, (c:k) Anon
 --
 -- All non-coercion binders are /visible/.
-mkTyConBindersPreferAnon :: [TyVar] -> TyCoVarSet -> [TyConBinder]
+mkTyConBindersPreferAnon :: [TyVar]      -- ^ binders
+                         -> TyCoVarSet   -- ^ free variables of result
+                         -> [TyConBinder]
 mkTyConBindersPreferAnon vars inner_tkvs = ASSERT( all isTyVar vars)
                                            fst (go vars)
   where



More information about the ghc-commits mailing list