Why do I need to derive my own `Show` instance for a tuple?

In the example I posted here, the compiler complains when I remove the line deriving instance Show (Int, Month, Int, Int, Int, Int, Int). Why is that line needed? I thought tuples had automatic Show instances.

2 Likes

Tuples don’t have automatic Show instances in the sense that they are not implicitly generated by the compiler. They are defined in the standard library but only for tuples up to and including length 5 atm. It would be possible to add more at the cost of blowing up the standard library a bit. However, I would argue that if you have a 6-tuple you should consider using a record instead.

4 Likes