Missing Typeable instances
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)
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |