On Thursday 19 May 2011 23:15:06, Andrew Coppin wrote: > On 19/05/2011 10:11 PM, Artyom Kazak wrote: > > And I can declare an instance for (x, y) which does NOT implies (Show > > x): > > > > instance Show (x, y) where > > show _ = "I'm tuple! Hooray!" > > Ah. So it's a feature. > > Fortunately I refactored the program where this came up, so it's no > longer an issue. I just wanted to see whether or not it was a bug. > > PS. Wouldn't such an instance require FlexibleContexts or something? >
No, the instance head is a type constructor applied to two distinct type variables, it's a perfectly valid H98 instance declaration. It won't be accepted though, because there is already instance (Show x, Show y) => Show (x,y) where ... I think basically the only way to make GHC accept the above instance involves NoImplicitPrelude (but I may be wrong). _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
