Skip to content

Move Typeable type-rep generation from use site to definition site

This ticket is a continuation of #9858 (closed). The interim solution for 7.10 was to generate Typeable data structures on the fly, as needed in client modules. This ticket is about moving the generation of the runtime representation of type constructors to their definition sites. (#9858 (closed) already has too much going on in it, so I started a fresh ticket for this refactoring.)

The branch is wip/T9858-typeable-spj.

In favour of (A) code at use site (as in 7.10):

  • Pay as you go. No code at all is generated unless you use Typeable

In favour of (B) code at definition site:

  • More sharing. We make a TyCon (see Data.Typeable.Internal) for T (say) just once, in the module that defines T.
  • We may ultimately want the TyCon for T to include its source location, and perhaps more besides. If it is defined in T it becomes easier to do that.

General observation: (B) is like Typeable was before, when it was an ordinary class. The difference now is that all types are Typeable.

Trac metadata
Trac field Value
Version 7.10.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information