[commit: ghc] wip/rae: Fix #12369 by being more flexible with data insts (1cf0827)

git at git.haskell.org git at git.haskell.org
Wed Jul 26 14:10:40 UTC 2017


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

On branch  : wip/rae
Link       : http://ghc.haskell.org/trac/ghc/changeset/1cf0827fc8b93f3c77daebf630d77f56660dbb6f/ghc

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

commit 1cf0827fc8b93f3c77daebf630d77f56660dbb6f
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


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

1cf0827fc8b93f3c77daebf630d77f56660dbb6f
 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 1cf0827fc8b93f3c77daebf630d77f56660dbb6f


More information about the ghc-commits mailing list