[commit: ghc] wip/T2893: Add superclasses to quantified constraints (910dfcf)

git at git.haskell.org git at git.haskell.org
Thu Mar 1 23:55:20 UTC 2018


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

On branch  : wip/T2893
Link       : http://ghc.haskell.org/trac/ghc/changeset/910dfcfeadc4f132e887bc4adf5ac2e17a29d99b/ghc

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

commit 910dfcfeadc4f132e887bc4adf5ac2e17a29d99b
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Mar 1 23:32:29 2018 +0000

    Add superclasses to quantified constraints
    
    This patch adds suppport for superclasses to quantified constraints.
    For example (contrived):
    
      f :: (forall a. Ord a => Ord (m a)) => m a -> m a -> Bool
      f x y = x==y
    
    Here we need (Eq (m a)); but the quantifed constraint deals only
    with Ord.  But we can make it work by using its superclass.
    
    This behaviour finally delivers on the promise of comment:30 of
    Trac #9123: we can write an implication constraint that solves
    the problem of higher-kinded roles.  Test
    quantified-constraints/T8123 demonstrates this in action.


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

910dfcfeadc4f132e887bc4adf5ac2e17a29d99b
 compiler/basicTypes/Id.hs                          |   2 +-
 compiler/typecheck/Inst.hs                         |   4 +-
 compiler/typecheck/TcCanonical.hs                  | 180 +++++++++++++--------
 compiler/typecheck/TcErrors.hs                     |   4 +-
 compiler/typecheck/TcEvTerm.hs                     |   5 +-
 compiler/typecheck/TcEvidence.hs                   |  74 +++++----
 compiler/typecheck/TcHsSyn.hs                      |  23 ++-
 compiler/typecheck/TcInstDcls.hs                   |   2 +-
 compiler/typecheck/TcInteract.hs                   |  61 +++----
 compiler/typecheck/TcMType.hs                      |   6 +-
 compiler/typecheck/TcPatSyn.hs                     |   7 +-
 compiler/typecheck/TcPluginM.hs                    |   2 +-
 compiler/typecheck/TcRnTypes.hs                    |  62 +++++--
 compiler/typecheck/TcSMonad.hs                     | 119 +++++++-------
 compiler/typecheck/TcSimplify.hs                   |   2 +-
 compiler/typecheck/TcType.hs                       |   2 +-
 compiler/types/Class.hs                            |  54 ++++---
 compiler/types/Kind.hs                             |   2 +
 testsuite/tests/quantified-constraints/T2893c.hs   |  15 ++
 .../quantified-constraints/{T2893b.hs => T9123.hs} |   2 +-
 testsuite/tests/quantified-constraints/T9123a.hs   |  26 +++
 testsuite/tests/quantified-constraints/all.T       |   5 +
 22 files changed, 403 insertions(+), 256 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 910dfcfeadc4f132e887bc4adf5ac2e17a29d99b


More information about the ghc-commits mailing list