[GHC] #14582: Review and improve the Typeable API

GHC ghc-devs at haskell.org
Thu Dec 14 17:48:16 UTC 2017


#14582: Review and improve the Typeable API
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:  Typeable
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 > `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.

 As noted in its documentation, `Data.Typeable` is the home of the old,
 non-type-indexed `Typeable` mechanism whereas the new mechanism lives in
 `Type.Reflection`. The goal of this design was to preserve compatibility
 with existing programs by minimizing the changes in `Data.Typeable`. All
 of the new bits, including the pattern synonyms (which are really only
 useful with the type-indexed variant), are exposed in `Type.Reflection`.

 > 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?

 My original intent was for this to be permanent. While working on the new
 `Typeable` implementation I viewed `Data.Typeable` and `Type.Reflection`
 as two mechanisms that, which while they happened to share implementation,
 serve rather different purposes. However, the name `TypeRep` seems to be
 quite applicable in both cases. I can see how the naming may be confusing
 and ideally the quantified variant would be called `SomeTypeRep` but I'm
 skeptical that deprecating the `Data.Typeable.TypeRep` synonym is worth
 the breakage that it would cause.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14582#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list