[GHC] #11011: Add type-indexed type representations (`TypeRep a`)

GHC ghc-devs at haskell.org
Wed Feb 24 13:25:01 UTC 2016


#11011: Add type-indexed type representations (`TypeRep a`)
-------------------------------------+-------------------------------------
        Reporter:  bjmprice          |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:
      Resolution:                    |             Keywords:
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 goldfire):

 I think that `unsafeCoerce` is quite bad and does threaten safety of the
 whole system, because you can always unpack a `TypeRep` from a `TypeRepX`.

 But I think I may have an answer -- I have written a very partial `Read`
 instance in a similar setup [https://github.com/goldfirere/dependent-
 db/blob/master/Basics.hs here] (used to implement my job talk). That
 indexed `TypeRepX` by a constraint, but I don't think you need that to get
 this done.

 A big difference between my approach and the real one will be that the
 real one must be open (allow datatype definitions), while my setup is
 closed. I don't think this is so terrible, though, as we can use a class
 (somewhat like my `TyConAble`) that provides the ability to read in a
 tycon. This class could be internal, perhaps protected by a name that
 can't be written in Haskell.

 Does this get you unstuck or have I done something silly?

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


More information about the ghc-tickets mailing list