GHC: Ticket #7214: Missing Typeable instances <p> 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: </p> <ul><li>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. </li></ul><ul><li>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. </li></ul><p> 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? </p> <p> To reproduce: </p> <pre class="wiki">Prelude&gt; :m Data.Typeable Prelude Data.Typeable&gt; typeOf (1,2,3,4,5,6,7) (Integer,Integer,Integer,Integer,Integer,Integer,Integer) Prelude Data.Typeable&gt; typeOf (1,2,3,4,5,6,7,8) &lt;interactive&gt;: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) </pre> en-us GHC Trac 1.0.1 selinger Tue, 04 Sep 2012 01:06:23 GMT status changed; resolution set <ul> <li><strong>status</strong> changed from <em>new</em> to <em>closed</em> </li> <li><strong>resolution</strong> set to <em>invalid</em> </li> </ul> <p> OK, two seconds after submitting this report, I found out how to do it. Sorry about that. For the record: </p> <p> import Data.Typeable </p> <p> instance (Typeable a, Typeable b, Typeable c, Typeable d, Typeable e, Typeable f, Typeable g, Typeable h) =&gt; Typeable (a,b,c,d,e,f,g,h) where </p> <blockquote> <p> typeOf (a,b,c,d,e,f,g,h) = </p> <blockquote> <p> mkTyCon3 "GHC" "Tuple" "(<sub></sub><sub>,)" <tt>mkTyConApp</tt> [ typeOf a, typeOf b, typeOf c, typeOf d, typeOf e, typeOf f, typeOf g, typeOf h ] </sub></p> </blockquote> </blockquote> <p> Part of the problem was that myTyCon has a different type in Data.Typeable.Internal than Data.Typeable. But I was just sitting on my brain. Sorry about that. </p> Ticket