[commit: ghc] master: Rework derivation of type representations for wired-in things (84b0ebe)

git at git.haskell.org git at git.haskell.org
Wed Jan 20 16:07:13 UTC 2016


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

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

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

commit 84b0ebedd09fcfbda8efd7576dce9f52a2b6e6ca
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Wed Jan 20 16:06:31 2016 +0100

    Rework derivation of type representations for wired-in things
    
    Previously types defined by `GHC.Types` and `GHC.Prim` had their
    `Typeable` representations manually defined in `GHC.Typeable.Internals`.
    This was terrible, resulting in a great deal of boilerplate and a number
    of bugs due to missing or inconsistent representations (see #11120).
    
    Here we take a different tack, initially proposed by Richard Eisenberg:
    We wire-in the `Module`, `TrName`, and `TyCon` types, allowing them to
    be used in `GHC.Types`. We then allow the usual type representation
    generation logic to handle this module.
    
    `GHC.Prim`, on the other hand, is a bit tricky as it has no object code
    of its own.  To handle this we instead place the type representations
    for the types defined here in `GHC.Types`.
    
    On the whole this eliminates several special-cases as well as a fair
    amount of boilerplate from hand-written representations. Moreover, we
    get full coverage of primitive types for free.
    
    Test Plan: Validate
    
    Reviewers: goldfire, simonpj, austin, hvr
    
    Subscribers: goldfire, simonpj, thomie
    
    Differential Revision: https://phabricator.haskell.org/D1774
    
    GHC Trac Issues: #11120


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

84b0ebedd09fcfbda8efd7576dce9f52a2b6e6ca
 compiler/basicTypes/OccName.hs                     |  13 +-
 compiler/basicTypes/Unique.hs                      |  16 +--
 compiler/iface/BuildTyCl.hs                        |   4 +-
 compiler/prelude/PrelNames.hs                      |  40 +++---
 compiler/prelude/TysPrim.hs                        |   4 +-
 compiler/prelude/TysWiredIn.hs                     | 113 ++++++++-------
 compiler/typecheck/TcRnDriver.hs                   |   5 +-
 compiler/typecheck/TcTypeable.hs                   | 155 ++++++++++++---------
 compiler/types/TyCon.hs                            |  31 ++++-
 compiler/vectorise/Vectorise/Type/TyConDecl.hs     |   2 +-
 libraries/base/Data/Typeable/Internal.hs           |  94 +++----------
 libraries/ghc-prim/GHC/Types.hs                    |  12 --
 .../tests/ghci.debugger/scripts/print019.stderr    |   2 +-
 testsuite/tests/typecheck/should_run/T11120.hs     |  10 ++
 testsuite/tests/typecheck/should_run/T11120.stdout |   1 +
 testsuite/tests/typecheck/should_run/all.T         |   1 +
 16 files changed, 255 insertions(+), 248 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 84b0ebedd09fcfbda8efd7576dce9f52a2b6e6ca


More information about the ghc-commits mailing list