If you have nested type, then it usually makes sense to have Show defined for the inside types, too, but it's not a requirement. Technically, only when you call 'show' for something in the data type you are defining Show for, *then* you need a Show instance defined for that inside-type.
On 19/05/2011 10:11 PM, Artyom Kazak wrote:Ah. So it's a feature.
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!"
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?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe