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

GHC ghc-devs at haskell.org
Thu Feb 25 15:27:19 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 bgamari):

 > If TyCon is unindexed then the first case should just work without it,

 Well, not quite. The trouble here is that kinds are necessarily of type
 `*`. That is, `mkTrCon` has type,

 {{{#!hs
 mkTrCon :: forall (k :: *) (a :: k). TyCon -> TTypeRep k -> TTypeRep a
 }}}

 That being said, a runtime check will suffice here.

 This still leaves the question of whether the given `TyCon` may plausibly
 have the requested kind, but at least this does away with the
 `unsafeCoerce`s.

 > in the second case, isn't it possible to do a runtime check that the
 kinds of rep_f and rep_x agree?

 Indeed, this ought to be possible. Thanks for bringing this up!

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


More information about the ghc-tickets mailing list