[Haskell-cafe] Reverse Show instance
markus.l2ll at gmail.com
Thu May 19 23:26:16 CEST 2011
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 Fri, May 20, 2011 at 12:15 AM, Andrew Coppin <andrewcoppin at btinternet.com
> 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?
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe