Why do I need to derive my own `Show` instance for a tuple?
App Development2 posts394 views6 likesLast activity May 2020
BE
bernhardOP
May 2020In 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.
CO
cocreature
May 2020Tuples 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.