[commit: ghc] master: Fix #15845 by defining etaExpandFamInstLHS and using it (63a8170)

git at git.haskell.org git at git.haskell.org
Thu Nov 8 15:38:30 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/63a817074a8d49798bfd46a6545906fff143e924/ghc

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

commit 63a817074a8d49798bfd46a6545906fff143e924
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Thu Nov 8 10:26:48 2018 -0500

    Fix #15845 by defining etaExpandFamInstLHS and using it
    
    Summary:
    Both #9692 and #14179 were caused by GHC being careless
    about using eta-reduced data family instance axioms. Each of those
    tickets were fixed by manually whipping up some code to eta-expand
    the axioms. The same sort of issue has now caused #15845, so I
    figured it was high time to factor out the code that each of these
    fixes have in common.
    
    This patch introduces the `etaExpandFamInstLHS` function, which takes
    a family instance's type variables, LHS types, and RHS type, and
    returns type variables and LHS types that have been eta-expanded if
    necessary, in the case of a data family instance. (If it's a type
    family instance, `etaExpandFamInstLHS` just returns the supplied type
    variables and LHS types unchanged).
    
    Along the way, I noticed that many references to
    `Note [Eta reduction for data families]` (in `FamInstEnv`) had
    slightly bitrotted (they either referred to a somewhat different
    name, or claimed that the Note lived in a different module), so
    I took the liberty of cleaning those up.
    
    Test Plan: make test TEST="T9692 T15845"
    
    Reviewers: goldfire, bgamari
    
    Reviewed By: goldfire
    
    Subscribers: rwbarton, carter
    
    GHC Trac Issues: #15845
    
    Differential Revision: https://phabricator.haskell.org/D5294


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

63a817074a8d49798bfd46a6545906fff143e924
 compiler/typecheck/TcSplice.hs   | 23 ++++++++---------------
 compiler/types/Coercion.hs       | 18 ++++--------------
 compiler/types/FamInstEnv.hs     |  8 +++++++-
 compiler/types/TyCon.hs          |  6 +++---
 compiler/types/Type.hs           | 39 +++++++++++++++++++++++++++++++++++++++
 testsuite/tests/th/T15845.hs     | 17 +++++++++++++++++
 testsuite/tests/th/T15845.stderr |  5 +++++
 testsuite/tests/th/T9692.stderr  |  3 ++-
 testsuite/tests/th/all.T         |  1 +
 9 files changed, 86 insertions(+), 34 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 63a817074a8d49798bfd46a6545906fff143e924


More information about the ghc-commits mailing list