• Ben Gamari's avatar
    Rework derivation of type representations for wired-in things · 84b0ebed
    Ben Gamari authored
    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
    84b0ebed
Unique.hs 13.3 KB