[commit: ghc] master: Refactor (~) to reduce the suerpclass stack (f265008)

git at git.haskell.org git at git.haskell.org
Fri Jul 27 09:07:00 UTC 2018


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

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

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

commit f265008fb6f70830e7e92ce563f6d83833cef071
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Fri Jul 27 09:01:46 2018 +0100

    Refactor (~) to reduce the suerpclass stack
    
    The constraint (~) used to be (effectively):
      class a ~~ b => (a :: k) ~ (b :: k)
    
    but, with this patch, it is now defined uniformly with
    (~~) and Coercible like this:
      class a ~# b => (a :: k) ~ (b :: k)
    
    Result:
      * One less superclass selection when goinng from (~) to (~#)
        Better for compile time and better for debugging with -ddump-simpl
    
      * The code for (~), (~~), and Coercible looks uniform, and appears
        together, e.g. in TysWiredIn and ClsInst.matchGlobalInst.
        Previously the code for (~) was different, and unique.
    
    Not only is this simpler, but it also makes the compiler a bit faster;
      T12227: 9% less allocation
      T12545: 7% less allocation
    
    This patch fixes Trac #15421


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

f265008fb6f70830e7e92ce563f6d83833cef071
 compiler/main/HscTypes.hs                          |  3 +-
 compiler/parser/Parser.y                           |  3 +-
 compiler/parser/RdrHsSyn.hs                        |  4 +-
 compiler/prelude/PrelNames.hs                      | 40 +++++-------
 compiler/prelude/PrelRules.hs                      |  6 +-
 compiler/prelude/TysPrim.hs                        | 25 ++++----
 compiler/prelude/TysWiredIn.hs                     | 72 ++++++++++++++++------
 compiler/typecheck/ClsInst.hs                      | 24 +++++---
 compiler/typecheck/Inst.hs                         |  9 +--
 compiler/typecheck/TcValidity.hs                   |  2 +-
 libraries/base/Data/Type/Equality.hs               | 24 --------
 libraries/ghc-prim/GHC/Types.hs                    |  6 ++
 testsuite/tests/ghci/scripts/T10059.stdout         | 13 ++--
 .../indexed-types/should_compile/T7837.stderr      |  3 +-
 testsuite/tests/perf/compiler/all.T                |  6 +-
 testsuite/tests/roles/should_compile/Roles3.stderr |  3 +-
 testsuite/tests/th/T10828.stderr                   |  6 +-
 17 files changed, 130 insertions(+), 119 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 f265008fb6f70830e7e92ce563f6d83833cef071


More information about the ghc-commits mailing list