
#14582: Review and improve the Typeable API -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Keywords: Typeable | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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 is fairly small. But `Data.Typeable.Internal` has a much larger API, which includes pattern synonyms and suchlike that appear to be for the benefit of clients, not just internal use. * The `Typeable` API has `type TypeRep = I.SomeTypeRep` which is different to the type-indexed `data TypeRep a` defined 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 `IsApplication` in `Internals` ([https://git.haskell.org/ghc.git/commitdiff/1acb922bb1186662919c1dbc0af596584... this commit]). It's hard for me to understand what's going on. I believe that the two pattern synonyms `App` and `Con` are supposed 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 `unsafeCoerce` to explain. * Do we really need `Con'` as well as `Con`? * The API could do with some careful documentation, in Haddock, but perhaps also an accomanying wiki page. It's tricky stuff. Here's the [wiki:Typeable Typeable wiki page] -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14582 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler