Review and improve the Typeable API
This ticket is to track improvements in the Typeable
API
There are a number of points I'm uncomfortable about
-
Data.Typable
is presumably meant to be the public API, and isfairly small. But
Data.Typeable.Internal
has a much largerAPI, which includes pattern synonyms and suchlike that appear
to be for the benefit of clients, not just internal use.
-
The
Typeable
API hastype TypeRep = I.SomeTypeRep
which isdifferent to the type-indexed
data TypeRep a
defined inData.Typeable.Internals
. This is exteremly confusing. Perhapsthis 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
IsApplication
inInternals
(this commit). It's hard for me to understand what's going on. Ibelieve that the two pattern synonyms
App
andCon
are supposedto be exhaustive -- if so, let's just write a COMPLETE pragma.
-
The code has many uses of
unsafeCoerce
, whereas the drive ofour "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
unsafeCoerce
to explain. -
Do we really need
Con'
as well asCon
? -
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
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |