Review and improve the Typeable API
This ticket is to track improvements in the
There are a number of points I'm uncomfortable about
Data.Typableis presumably meant to be the public API, and is
fairly small. But
Data.Typeable.Internalhas a much larger
API, which includes pattern synonyms and suchlike that appear
to be for the benefit of clients, not just internal use.
type TypeRep = I.SomeTypeRepwhich is
different to the type-indexed
data TypeRep adefined in
Data.Typeable.Internals. This is exteremly confusing. Perhaps
this is intended to be temporary, while we are moving over to the new type-indexed
representation. But then what's the transition plan?
I cordially dislike this stuff about
Internals(this commit). It's hard for me to understand what's going on. I
believe that the two pattern synonyms
to be exhaustive -- if so, let's just write a COMPLETE pragma.
The code has many uses of
unsafeCoerce, whereas the drive of
our "Typed reflection in Haskell" paper was to reduced the size
of the trusted code base. I'd like to see a comment on each of
those uses of
Do we really need
Con'as well as
The API could do with some careful documentation, in Haddock,
but perhaps also an accomanying wiki page. It's tricky stuff.
Here's the Typeablewikipage