[GHC] #3480: Add Show and Binary instances for TypeRep

GHC cvs-ghc at haskell.org
Wed Oct 12 14:37:15 CEST 2011


#3480: Add Show and Binary instances for TypeRep
-----------------------------+----------------------------------------------
  Reporter:  guest           |          Owner:                      
      Type:  task            |         Status:  new                 
  Priority:  normal          |      Milestone:  7.2.1               
 Component:  libraries/base  |        Version:                      
Resolution:                  |       Keywords:  Typeable, efficiency
  Testcase:                  |      Blockedby:                      
Difficulty:  Unknown         |             Os:  Unknown/Multiple    
  Blocking:                  |   Architecture:  Unknown/Multiple    
   Failure:  None/Unknown    |  
-----------------------------+----------------------------------------------

Comment(by lealanko):

 I'm sorry for messing up the ticket. I had assumed that the missing
 {{{Show}}} instance had been a simple oversight. If so, this would
 suffice:

 {{{
 instance Show TypeRepKey where
   show (TypeRepKey (Fingerprint hi lo)) = printf "%016x%016x" hi lo
 }}}

 A {{{Binary}}} instance is more difficult: where would it be put? It
 cannot be in {{{Typeable.hs}}} (as {{{base}}} cannot depend on
 {{{binary}}}), but it cannot be in {{{Binary.hs}}} either (as
 {{{TypeRepKey}}} is opaque and not exposed from {{{Typeable}}}).

 I don't think it's a good idea to make {{{TypeRep}}}s themselves publicly
 deserializable, as that would allow the creation of fake typereps. A
 separate one-way injection to a serializable {{{TypeRepKey}}} seems much
 more secure.

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



More information about the Glasgow-haskell-bugs mailing list