[commit: ghc] ghc-8.6: Instantiate GND bindings with an explicit type signature (c0323d9)

git at git.haskell.org git at git.haskell.org
Thu Jul 12 22:21:37 UTC 2018


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

On branch  : ghc-8.6
Link       : http://ghc.haskell.org/trac/ghc/changeset/c0323d979d3676f919d6d02aecad7a8bfdcb8b8d/ghc

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

commit c0323d979d3676f919d6d02aecad7a8bfdcb8b8d
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Thu Jul 5 08:30:05 2018 -0400

    Instantiate GND bindings with an explicit type signature
    
    Summary:
    Before, we were using visible type application to apply
    impredicative types to `coerce` in
    `GeneralizedNewtypeDeriving`-generated bindings. This approach breaks
    down when combined with `QuantifiedConstraints` in certain ways,
    which #14883 and #15290 provide examples of. See
    Note [GND and QuantifiedConstraints] for all the gory details.
    
    To avoid this issue, we instead use an explicit type signature to
    instantiate each GND binding, and use that to bind any type variables
    that might be bound by a class method's type signature. This reduces
    the need to impredicative type applications, and more importantly,
    makes the programs from #14883 and #15290 work again.
    
    Test Plan: make test TEST="T15290b T15290c T15290d T14883"
    
    Reviewers: simonpj, bgamari
    
    Reviewed By: simonpj
    
    Subscribers: rwbarton, thomie, carter
    
    GHC Trac Issues: #14883, #15290
    
    Differential Revision: https://phabricator.haskell.org/D4895
    
    (cherry picked from commit 132273f34e394bf7e900d0c15e01e91edd711890)


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

c0323d979d3676f919d6d02aecad7a8bfdcb8b8d
 compiler/hsSyn/HsUtils.hs                          |   2 +-
 compiler/rename/RnSource.hs                        |   2 +-
 compiler/typecheck/TcGenDeriv.hs                   | 148 ++++++++++++++++++---
 .../tests/deriving/should_compile/T14578.stderr    | 103 +++++++-------
 .../should_compile/T14883.hs}                      |   6 +-
 testsuite/tests/deriving/should_compile/T15290c.hs |  20 +++
 testsuite/tests/deriving/should_compile/T15290d.hs |  12 ++
 testsuite/tests/deriving/should_compile/all.T      |   3 +
 testsuite/tests/deriving/should_fail/T15073.stderr |  26 ++--
 testsuite/tests/deriving/should_fail/T4846.stderr  |   5 +-
 10 files changed, 234 insertions(+), 93 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 c0323d979d3676f919d6d02aecad7a8bfdcb8b8d


More information about the ghc-commits mailing list