[commit: ghc] master: Refactor the kind-checking of tyvar binders (9fc40c7)

git at git.haskell.org git at git.haskell.org
Mon Jun 25 14:35:19 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/9fc40c733ba8822a04bd92883801b214dee099ca/ghc

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

commit 9fc40c733ba8822a04bd92883801b214dee099ca
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Jun 25 13:20:59 2018 +0100

    Refactor the kind-checking of tyvar binders
    
    The refactoring here is driven by the ghastly mess described in
    comment:24 of Trac #1520.  The overall goal is to simplify the
    kind-checking of typev-variable binders, and in particular to narrow
    the use of the "in-scope tyvar binder" stuff,
    which is needed only for associated types: see the new
    Note [Kind-checking tyvar binders for associated types] in TcHsType.
    
    Now
    
    * The "in-scope tyvar binder" stuff is done only in
         - kcLHsQTyVars, which is used for the LHsQTyVars of a
           data/newtype, or type family declaration.
    
         - tcFamTyPats, which is used for associated family instances;
           it now calls tcImplicitQTKBndrs, which in turn usese
           newFlexiKindedQTyVar
    
    * tcExpicitTKBndrs (which is used only for function signatures,
      data con signatures, pattern synonym signatures, and expression
      type signatures) now does not go via the "in-scope tyvar binder"
      stuff at all.
    
    While I'm still not happy with all this code, the code is generally
    simpler, and I think this is a useful step forward. It does cure
    the problem too.
    
    (It's hard to trigger the problem in vanilla Haskell code, because
    the renamer would normally use different names for nested binders,
    so I can't offer a test.)


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

9fc40c733ba8822a04bd92883801b214dee099ca
 compiler/hsSyn/HsDecls.hs          |  43 +++++--
 compiler/typecheck/TcHsType.hs     | 258 +++++++++++++++++++++----------------
 compiler/typecheck/TcTyClsDecls.hs |   3 +-
 3 files changed, 178 insertions(+), 126 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9fc40c733ba8822a04bd92883801b214dee099ca


More information about the ghc-commits mailing list