[commit: ghc] master: Fix #12369 by being more flexible with data insts (4239238)

git at git.haskell.org git at git.haskell.org
Thu Jul 27 11:50:10 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/4239238306e911803bf61fdda3ad356fd0b42e05/ghc

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

commit 4239238306e911803bf61fdda3ad356fd0b42e05
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date:   Wed Jul 19 12:28:04 2017 -0400

    Fix #12369 by being more flexible with data insts
    
    Previously, a data family's kind had to end in `Type`,
    and data instances had to list all the type patterns for the
    family. However, both of these restrictions were unnecessary:
    
    - A data family's kind can usefully end in a kind variable `k`.
      See examples on #12369.
    
    - A data instance need not list all patterns, much like how a
      GADT-style data declaration need not list all type parameters,
      when a kind signature is in place. This is useful, for example,
      here:
    
        data family Sing (a :: k)
        data instance Sing :: Bool -> Type where ...
    
    This patch also improved a few error messages, as some error
    plumbing had to be moved around.
    
    See new Note [Arity of data families] in FamInstEnv for more
    info.
    
    test case: indexed-types/should_compile/T12369


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

4239238306e911803bf61fdda3ad356fd0b42e05
 compiler/typecheck/TcHsSyn.hs                      |   2 +-
 compiler/typecheck/TcHsType.hs                     | 175 ++++++++-------
 compiler/typecheck/TcInstDcls.hs                   |  25 ++-
 compiler/typecheck/TcTyClsDecls.hs                 | 239 ++++++++++++++++-----
 compiler/typecheck/TcValidity.hs                   |  42 ++--
 compiler/types/FamInstEnv.hs                       |  43 +++-
 compiler/types/TyCon.hs                            |  10 +-
 compiler/types/Type.hs                             |   2 +-
 docs/users_guide/8.4.1-notes.rst                   |   6 +
 docs/users_guide/glasgow_exts.rst                  |   5 +
 .../tests/indexed-types/should_compile/T12369.hs   |  35 +++
 testsuite/tests/indexed-types/should_compile/all.T |   1 +
 .../indexed-types/should_fail/ExtraTcsUntch.stderr |   6 +-
 .../indexed-types/should_fail/Overlap4.stderr      |   8 +-
 .../indexed-types/should_fail/SimpleFail1b.stderr  |   8 +-
 .../indexed-types/should_fail/TyFamArity1.stderr   |   8 +-
 .../indexed-types/should_fail/TyFamArity2.stderr   |   9 +-
 17 files changed, 415 insertions(+), 209 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 4239238306e911803bf61fdda3ad356fd0b42e05


More information about the ghc-commits mailing list