[GHC] #10343: Make Typeable track kind information better

GHC ghc-devs at haskell.org
Mon Jan 25 11:07:56 UTC 2016


#10343: Make Typeable track kind information better
-------------------------------------+-------------------------------------
        Reporter:  oerjan            |                Owner:  goldfire
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.10.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:  typeOf ::
                                     |  Typeable (a::k) => Proxy a ->
                                     |  TypeRep
      Blocked By:                    |             Blocking:
 Related Tickets:  #9858             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by bgamari):

 Perhaps something like this?

 {{{#!hs
 data Fingerprint = Fingerprint {- Int -}

 data TyCon a = TyCon Fingerprint String

 data TypeRep (a :: k) where
     TypeCon :: TyCon a -> TypeRep k -> TypeRep (a :: k)
     TypeApp :: forall k a (b :: k).
                TypeRep (a -> b)
             -> TypeRep a
             -> TypeRep (b :: k)

 class Typeable k => Typeable (a :: k) where
     typeRep :: Proxy a -> TypeRep a

 typeRepKind :: TypeRep (a :: k) -> TypeRep k
 typeRepKind (TypeCon _ k) = k

 typeRepName :: TypeRep a -> String
 typeRepName (TypeCon (TyCon _ n) _) = n
 }}}

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


More information about the ghc-tickets mailing list