[GHC] #7214: Missing Typeable instances

GHC cvs-ghc at haskell.org
Tue Sep 4 02:49:13 CEST 2012


#7214: Missing Typeable instances
------------------------------+---------------------------------------------
 Reporter:  selinger          |          Owner:                  
     Type:  bug               |         Status:  new             
 Priority:  normal            |      Component:  libraries/base  
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  Other             |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 Data.Typeable defines Typeable instances for tuples of length up to 7. My
 code needs such instances for up to 10-tuples (currently).
 There are several reasons why this causes problems:

 * It is not at all clear how to define new instances in user code, because
 no public interface is provided for doing so. It does not seem to be
 documented in Data.Typeable or Data.Typeable.Internal how to extend this
 to new instances for existing types. The code in Data.Typeable.Internal
 relies heavily on preprocessor macros and internal representations, such
 as Fingerprints, GHC-generated MD5 hashes, and so on. I tried mimicking
 what was there to add an instance for 8-tuples and failed.

 * Even if someone manages to write their own module defining the missing
 Typeable instances, the code will break as soon as someone decides to
 extend Data.Typeable upstream.

 Is this a problem in desperate need of a general solution, or have I
 simply missed something? What is so special about the number 7?

 To reproduce:

 {{{
 Prelude> :m Data.Typeable
 Prelude Data.Typeable> typeOf (1,2,3,4,5,6,7)
 (Integer,Integer,Integer,Integer,Integer,Integer,Integer)
 Prelude Data.Typeable> typeOf (1,2,3,4,5,6,7,8)

 <interactive>:0:1:
     No instance for (Typeable7 ((,,,,,,,) t0))
       arising from a use of `typeOf'
     Possible fix:
       add an instance declaration for (Typeable7 ((,,,,,,,) t0))
     In the expression: typeOf (1, 2, 3, 4, 5, 6, 7, 8)
     In an equation for `it': it = typeOf (1, 2, 3, 4, 5, 6, 7, 8)
 }}}

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



More information about the Glasgow-haskell-bugs mailing list