[Haskell-cafe] Make Show instance

Daniel Patterson lists.haskell at dbp.mm.st
Thu Jul 21 17:09:03 CEST 2011


The documentation for the Show typeclass has this very example: http://hackage.haskell.org/packages/archive/base/latest/doc/html/Prelude.html#t:Show

The summary? you need to define either showPrec or show, the latter of which is simpler, it is just a -> String.

So:

instance Show (Tree Int Int) where
	show (Tree (Node (k,v)) left right) = ...

On Jul 21, 2011, at 10:55 AM, Александр wrote:

> Hello,  thank you for reply. I know that i can derive this. But i want to know how can i make it by hand.
> 
> Thank you.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110721/5b44d3cb/attachment.htm>


More information about the Haskell-Cafe mailing list