[commit: ghc] master: Clean up Coercible handling, and interaction of data families with newtypes (0aaf812)

git at git.haskell.org git at git.haskell.org
Fri Sep 19 11:30:56 UTC 2014


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/0aaf812ed0a4a4be9528b2e2f6b72bee7cd8002d/ghc

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

commit 0aaf812ed0a4a4be9528b2e2f6b72bee7cd8002d
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Sep 18 16:19:55 2014 +0100

    Clean up Coercible handling, and interaction of data families with newtypes
    
    This patch fixes Trac #9580, in which the Coercible machinery succeeded
    even though the relevant data constructor was not in scope.
    
    As usual I got dragged into a raft of refactoring changes,
    all for the better.
    
    * Delete TcEvidence.coercionToTcCoercion (now unused)
    
    * Move instNewTyConTF_maybe, instNewTyCon_maybe to FamInst,
      and rename them to tcInstNewTyConTF_maybe, tcInstNewTyCon
      (They both return TcCoercions.)
    
    * tcInstNewTyConTF_maybe also gets more convenient type,
      which improves TcInteract.getCoercibleInst
    
    * Define FamInst.tcLookupDataFamInst, and use it in TcDeriv,
      (as well as in tcInstNewTyConTF_maybe)
    
    * Improve error report for Coercible errors, when data familes
      are involved  Another use of tcLookupDataFamInst
    
    * In TcExpr.tcTagToEnum, use tcLookupDataFamInst to replace
      local hacky code
    
    * Fix Coercion.instNewTyCon_maybe and Type.newTyConInstRhs to deal
      with eta-reduced newtypes, using
      (new) Type.unwrapNewTyConEtad_maybe and (new) Type.applyTysX
    
    Some small refactoring of TcSMonad.matchFam.


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

0aaf812ed0a4a4be9528b2e2f6b72bee7cd8002d
 compiler/hsSyn/HsUtils.lhs                         | 15 +++-
 compiler/typecheck/FamInst.lhs                     | 74 +++++++++++++-----
 compiler/typecheck/TcDeriv.lhs                     | 28 ++-----
 compiler/typecheck/TcErrors.lhs                    | 45 +++++------
 compiler/typecheck/TcEvidence.lhs                  | 21 +-----
 compiler/typecheck/TcExpr.lhs                      | 46 ++++-------
 compiler/typecheck/TcInteract.lhs                  | 88 ++++++++++------------
 compiler/typecheck/TcSMonad.lhs                    | 17 +++--
 compiler/types/Coercion.lhs                        |  6 +-
 compiler/types/FamInstEnv.lhs                      | 29 +------
 compiler/types/TyCon.lhs                           |  9 ++-
 compiler/types/Type.lhs                            | 22 ++++--
 testsuite/tests/indexed-types/should_fail/T9580.hs |  7 ++
 .../tests/indexed-types/should_fail/T9580.stderr   | 10 +++
 .../tests/indexed-types/should_fail/T9580a.hs      |  5 ++
 testsuite/tests/indexed-types/should_fail/all.T    |  1 +
 .../typecheck/should_fail/TcCoercibleFail.stderr   |  3 +-
 17 files changed, 214 insertions(+), 212 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 0aaf812ed0a4a4be9528b2e2f6b72bee7cd8002d


More information about the ghc-commits mailing list