[commit: ghc] master: Generalize kind of the (->) tycon (b207b53)

git at git.haskell.org git at git.haskell.org
Sat Feb 18 05:10:54 UTC 2017


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

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

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

commit b207b536ded40156f9adb168565ca78e1eef2c74
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Wed Feb 1 20:25:33 2017 -0500

    Generalize kind of the (->) tycon
    
    This is generalizes the kind of `(->)`, as discussed in #11714.
    
    This involves a few things,
    
     * Generalizing the kind of `funTyCon`, adding two new `RuntimeRep`
    binders,
      ```lang=haskell
    (->) :: forall (r1 :: RuntimeRep) (r2 :: RuntimeRep)
                   (a :: TYPE r1) (b :: TYPE r2).
            a -> b -> *
      ```
    
     * Unsaturated applications of `(->)` are expressed as explicit
    `TyConApp`s
    
     * Saturated applications of `(->)` are expressed as `FunTy` as they are
    currently
    
     * Saturated applications of `(->)` are expressed by a new `FunCo`
    constructor in coercions
    
     * `splitTyConApp` needs to ensure that `FunTy`s are split to a
    `TyConApp`
       of `(->)` with the appropriate `RuntimeRep` arguments
    
     * Teach CoreLint to check that all saturated applications of `(->)` are
    represented with `FunTy`
    
    At the moment I assume that `Constraint ~ *`, which is an annoying
    source of complexity. This will
    be simplified once D3023 is resolved.
    
    Also, this introduces two known regressions,
    
    `tcfail181`, `T10403`
    =====================
    Only shows the instance,
    
        instance Monad ((->) r) -- Defined in ‘GHC.Base’
    
    in its error message when -fprint-potential-instances is used. This is
    because its instance head now mentions 'LiftedRep which is not in scope.
    I'm not entirely sure of the right way to fix this so I'm just accepting
    the new output for now.
    
    T5963 (Typeable)
    ================
    
    T5963 is now broken since Data.Typeable.Internals.mkFunTy computes its
    fingerprint without the RuntimeRep variables that (->) expects. This
    will be fixed with the merge of D2010.
    
    Haddock performance
    ===================
    
    The `haddock.base` and `haddock.Cabal` tests regress in allocations by
    about 20%. This certainly hurts, but it's also not entirely unexpected:
    the size of every function type grows with this patch and Haddock has a
    lot of functions in its heap.


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

b207b536ded40156f9adb168565ca78e1eef2c74
 compiler/coreSyn/CoreFVs.hs                        |   1 +
 compiler/coreSyn/CoreLint.hs                       |  33 +++--
 compiler/coreSyn/CoreSubst.hs                      |   4 +-
 compiler/coreSyn/TrieMap.hs                        |   6 +-
 compiler/iface/ToIface.hs                          |   6 +-
 compiler/prelude/TysPrim.hs                        |  27 ++--
 compiler/specialise/Rules.hs                       |   6 +
 compiler/typecheck/TcCanonical.hs                  |  47 ++++++-
 compiler/typecheck/TcSMonad.hs                     |   2 +-
 compiler/typecheck/TcTyDecls.hs                    |   1 +
 compiler/typecheck/TcType.hs                       |  98 +++++++++++--
 compiler/typecheck/TcUnify.hs                      |   3 +
 compiler/typecheck/TcValidity.hs                   |   1 +
 compiler/types/Coercion.hs                         | 118 +++++++++++++---
 compiler/types/Coercion.hs-boot                    |   6 +-
 compiler/types/FamInstEnv.hs                       |   1 +
 compiler/types/OptCoercion.hs                      |   9 ++
 compiler/types/TyCoRep.hs                          |  13 +-
 compiler/types/TyCon.hs                            |   4 +-
 compiler/types/Type.hs                             | 156 +++++++++++++++++----
 compiler/types/Unify.hs                            |  20 ++-
 libraries/base/tests/all.T                         |   2 +-
 testsuite/tests/ghci/scripts/T8535.stdout          |   2 +-
 testsuite/tests/ghci/scripts/ghci020.stdout        |   2 +-
 testsuite/tests/ghci/should_run/T10145.stdout      |   2 +-
 .../partial-sigs/should_compile/T10403.stderr      |   3 +-
 testsuite/tests/perf/compiler/all.T                |   3 +-
 testsuite/tests/perf/haddock/all.T                 |   6 +-
 testsuite/tests/typecheck/should_compile/all.T     |   2 +-
 .../tests/typecheck/should_compile/tc167.stderr    |   6 -
 .../tests/typecheck/should_fail/tcfail181.stderr   |   5 +-
 31 files changed, 480 insertions(+), 115 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 b207b536ded40156f9adb168565ca78e1eef2c74


More information about the ghc-commits mailing list