[commit: ghc] wip/over-poly-kinds: Stop inferring over-polymorphic kinds (c0e9593)

git at git.haskell.org git at git.haskell.org
Sat Feb 23 19:22:58 UTC 2019


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

On branch  : wip/over-poly-kinds
Link       : http://ghc.haskell.org/trac/ghc/changeset/c0e959388899eab168b422ac37846025f697de7f/ghc

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

commit c0e959388899eab168b422ac37846025f697de7f
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Feb 21 15:27:17 2019 +0000

    Stop inferring over-polymorphic kinds
    
    Before this patch GHC was trying to be too clever
    (Trac #16344); it succeeded in kind-checking this
    polymorphic-recursive declaration
    
        data T ka (a::ka) b
          = MkT (T Type           Int   Bool)
                (T (Type -> Type) Maybe Bool)
    
    As Note [No polymorphic recursion] discusses, the "solution" was
    horribly fragile.  So this patch deletes the key lines in
    TcHsType, and a wodge of supporting stuff in the renamer.
    
    There were two regressions, both the same: a closed type family
    decl like this (T12785b) does not have a CUSK:
      type family Payload (n :: Peano) (s :: HTree n x) where
        Payload Z (Point a) = a
        Payload (S n) (a `Branch` stru) = a
    
    To kind-check the equations we need a dependent kind for
    Payload, and we don't get that any more.  Solution: make it
    a CUSK by giving the result kind -- probably a good thing anyway.
    
    The other case (T12442) was very similar: a close type family
    declaration without a CUSK.


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

c0e959388899eab168b422ac37846025f697de7f
 compiler/deSugar/DsMeta.hs                         | 15 +---
 compiler/hieFile/HieAst.hs                         |  2 +-
 compiler/hsSyn/HsTypes.hs                          | 32 +++----
 compiler/rename/RnSource.hs                        |  4 +-
 compiler/rename/RnTypes.hs                         | 14 +---
 compiler/typecheck/TcHsType.hs                     | 97 +++++++++-------------
 compiler/typecheck/TcTyClsDecls.hs                 |  6 +-
 testsuite/tests/dependent/should_compile/T12442.hs |  3 +-
 testsuite/tests/dependent/should_fail/T16344.hs    |  8 ++
 .../tests/dependent/should_fail/T16344.stderr      |  6 ++
 testsuite/tests/dependent/should_fail/all.T        |  1 +
 .../parser/should_compile/DumpRenamedAst.stderr    | 32 ++-----
 .../tests/parser/should_compile/T14189.stderr      | 15 ++--
 testsuite/tests/typecheck/should_fail/T12785b.hs   |  4 +-
 14 files changed, 93 insertions(+), 146 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 c0e959388899eab168b422ac37846025f697de7f


More information about the ghc-commits mailing list