[Haskell-cafe] tuples and Show in GHC

Simon Peyton-Jones simonpj at microsoft.com
Mon Mar 7 04:27:51 EST 2005


No principled reason.  I wish there was no limit, which would involve
generating code on the fly for instances that weren't pre-generated, but
I never got around to implementing that.  So you have to stop somewhere.
Actually the Report says it should have Show instances up to 15 at
least, but GHC doesn't.  That isn't deliberate, and I guess we should
fix it.

Simon

| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org
[mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Stijn
| De Saeger
| Sent: 06 March 2005 09:40
| To: haskell-cafe at haskell.org
| Subject: [Haskell-cafe] tuples and Show in GHC
| 
| hi all,
| 
| Is there a principled reason why in GHC tuples with up to five
| elements automatically derive from the Show class but from six
| elements and up they don't anymore? If this is not a bug I would be
| very curious to hear what the reasoning behind this is....
| below is an example of said behaviour :
| 
| > type MyInt1 = (Int,Int,Int,Int,Int)
| > myInt1 :: MyInt1
| > myInt1 = (1,2,3,4,5)
| > type MyInt2 = (Int,Int,Int,Int,Int,Int)
| > myInt2 :: MyInt2
| > myInt2 = (1,2,3,4,5,6)
| 
| ....
| 
| *HS> myInt1
| Loading package haskell98 ... linking ... done.
| (1,2,3,4,5)
| *HS> myInt2
| 
| <interactive>:1:
|     No instance for (Show MyInt2)
|       arising from use of `print' at <interactive>:1
|     In a 'do' expression: print it
| *HS>
| 
| stijn.
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list