[commit: ghc] master: Allow recursive (undecidable) superclasses (6eabb6d)

git at git.haskell.org git at git.haskell.org
Tue Dec 15 14:33:38 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/6eabb6ddb7c53784792ee26b1e0657bde7eee7fb/ghc

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

commit 6eabb6ddb7c53784792ee26b1e0657bde7eee7fb
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Dec 15 14:26:13 2015 +0000

    Allow recursive (undecidable) superclasses
    
    This patch fulfils the request in Trac #11067, #10318, and #10592,
    by lifting the conservative restrictions on superclass constraints.
    
    These restrictions are there (and have been since Haskell was born) to
    ensure that the transitive superclasses of a class constraint is a finite
    set.  However (a) this restriction is conservative, and can be annoying
    when there really is no recursion, and (b) sometimes genuinely recursive
    superclasses are useful (see the tickets).
    
    Dimitrios and I worked out that there is actually a relatively simple way
    to do the job. It’s described in some detail in
    
       Note [The superclass story] in TcCanonical
       Note [Expanding superclasses] in TcType
    
    In brief, the idea is to expand superclasses only finitely, but to
    iterate (using a loop that already existed) if there are more
    superclasses to explore.
    
    Other small things
    
    - I improved grouping of error messages a bit in TcErrors
    
    - I re-centred the haddock.compiler test, which was at 9.8%
      above the norm, and which this patch pushed slightly over


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

6eabb6ddb7c53784792ee26b1e0657bde7eee7fb
 compiler/main/DynFlags.hs                          |   2 +
 compiler/typecheck/TcCanonical.hs                  | 256 ++++++++++++++-------
 compiler/typecheck/TcErrors.hs                     |  84 +++++--
 compiler/typecheck/TcInteract.hs                   |  18 +-
 compiler/typecheck/TcRnTypes.hs                    |  18 +-
 compiler/typecheck/TcSMonad.hs                     |  37 ++-
 compiler/typecheck/TcSimplify.hs                   | 113 ++++++---
 compiler/typecheck/TcTyClsDecls.hs                 |  21 +-
 compiler/typecheck/TcTyDecls.hs                    | 207 ++++++++---------
 compiler/typecheck/TcType.hs                       |  90 ++++++--
 compiler/utils/Bag.hs                              |  16 +-
 docs/users_guide/glasgow_exts.rst                  |  49 ++++
 libraries/ghc-prim/GHC/Classes.hs                  |   2 +
 testsuite/tests/ado/ado004.stderr                  |  10 +-
 testsuite/tests/driver/T4437.hs                    |   1 +
 testsuite/tests/ghci/scripts/ghci013.stdout        |   2 +-
 .../tests/indexed-types/should_compile/T10318.hs   |  35 +++
 .../tests/indexed-types/should_compile/T11067.hs   |  35 +++
 .../indexed-types/should_compile/T3017.stderr      |   2 +-
 .../indexed-types/should_compile/T3208b.stderr     |  10 -
 .../indexed-types/should_compile/T8889.stderr      |   4 +-
 testsuite/tests/indexed-types/should_compile/all.T |   2 +
 .../tests/indexed-types/should_fail/T1897b.stderr  |  22 +-
 .../tests/indexed-types/should_fail/T3330a.stderr  |  22 +-
 .../tests/indexed-types/should_fail/T4174.stderr   |  16 --
 .../tests/indexed-types/should_fail/T8227.stderr   |  35 +--
 .../tests/indexed-types/should_fail/T9662.stderr   |  80 +------
 testsuite/tests/module/mod40.stderr                |  18 +-
 .../should_compile/ExtraConstraints1.stderr        |   6 +-
 .../should_compile/ExtraConstraints3.stderr        |  38 +--
 .../WarningWildcardInstantiations.stderr           |   2 +-
 .../InstantiatedNamedWildcardsInConstraints.stderr |   2 +-
 .../tests/partial-sigs/should_fail/T10999.stderr   |   6 +-
 .../should_fail/WildcardInstantiations.stderr      |   2 +-
 testsuite/tests/perf/haddock/all.T                 |   3 +-
 testsuite/tests/pmcheck/should_compile/T3927b.hs   |   1 +
 testsuite/tests/polykinds/T7332.hs                 |  30 ++-
 testsuite/tests/polykinds/T7594.hs                 |   2 +
 testsuite/tests/polykinds/T7594.stderr             |  27 +--
 testsuite/tests/polykinds/T9017.stderr             |  13 --
 .../tests/simplCore/should_compile/T4398.stderr    |   2 +-
 testsuite/tests/typecheck/should_compile/T10100.hs |   1 +
 testsuite/tests/typecheck/should_compile/T10109.hs |   1 +
 testsuite/tests/typecheck/should_compile/T10564.hs |   1 +
 .../tests/typecheck/should_compile/T9834.stderr    |  45 +---
 testsuite/tests/typecheck/should_compile/tc256.hs  |   2 +-
 testsuite/tests/typecheck/should_fail/T2714.stderr |  35 +--
 testsuite/tests/typecheck/should_fail/T5853.stderr |  22 +-
 testsuite/tests/typecheck/should_fail/T7869.stderr |  43 ++--
 testsuite/tests/typecheck/should_fail/T8883.stderr |  12 +-
 testsuite/tests/typecheck/should_fail/T9415.stderr |  18 +-
 testsuite/tests/typecheck/should_fail/T9739.stderr |  20 +-
 .../tests/typecheck/should_fail/tcfail027.stderr   |  18 +-
 testsuite/tests/typecheck/should_fail/tcfail216.hs |   1 -
 .../tests/typecheck/should_fail/tcfail216.stderr   |   9 +-
 testsuite/tests/typecheck/should_fail/tcfail217.hs |   2 +-
 .../tests/typecheck/should_fail/tcfail217.stderr   |   6 +-
 57 files changed, 895 insertions(+), 682 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 6eabb6ddb7c53784792ee26b1e0657bde7eee7fb


More information about the ghc-commits mailing list