diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2016-01-20 16:06:31 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-01-20 17:08:05 +0100 |
commit | 84b0ebedd09fcfbda8efd7576dce9f52a2b6e6ca (patch) | |
tree | 3a40ac5518869947bf98bf1451b1915d75ffbe81 /libraries/ghc-prim | |
parent | 5cce09543db827e662539523ffff4513deb92777 (diff) | |
download | haskell-84b0ebedd09fcfbda8efd7576dce9f52a2b6e6ca.tar.gz |
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
Diffstat (limited to 'libraries/ghc-prim')
-rw-r--r-- | libraries/ghc-prim/GHC/Types.hs | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/libraries/ghc-prim/GHC/Types.hs b/libraries/ghc-prim/GHC/Types.hs index 2ce4c7ee7e..dc6c0f5c90 100644 --- a/libraries/ghc-prim/GHC/Types.hs +++ b/libraries/ghc-prim/GHC/Types.hs @@ -363,18 +363,6 @@ type lets us use the TrNameS constructor when allocating static data; but we also need TrNameD for the case where we are deserialising a TyCon or Module (for example when deserialising a TypeRep), in which case we can't conveniently come up with an Addr#. - - -Note [Representations of types defined in GHC.Types] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The representations for the types defined in GHC.Types are -defined in GHC.Typeable.Internal. - -Any types defined here must also have a corresponding TyCon representation -defined in Data.Typeable.Internal. Also, if the type is promotable it must also -have a TyCon for each promoted data constructor. - -} #include "MachDeps.h" |