[Haskell-cafe] Reverse Show instance

Artyom Kazak artyom.kazak at gmail.com
Thu May 19 23:11:51 CEST 2011


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!"


Andrew Coppin <andrewcoppin at btinternet.com> писал(а) в своём письме Fri,  
20 May 2011 00:08:27 +0300:

>    Cannot deduce (Show x) from context (Show (x, y)).
>    Cannot deduce (Show y) from context (Show (x, y)).
>
> Um... seriously?
>
>  From Prelude, we have
>
>    Show x, Show y => Show (x, y)
>
> So clearly it works in the forward direction. But apparently not in the  
> reverse direction.
>
> Is this a bug or a feature? (I.e., is there some obscure possibility I  
> haven't thought of which means that doing the reverse inference would be  
> incorrect?)
>
> _______________________________________________
> 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