[Haskell-cafe] Make Show instance
Александр
kommunist1917 at mail.ru
Thu Jul 21 16:45:13 CEST 2011
Hello,
I have binary tree, with every leaf tuple - (k,v):
data Tree k v = EmptyTree
| Node (k, v) (Tree k v) (Tree k v)
How can i make Show Instance for (Tree Int Int) ?
I try:
instance Show (Tree k v) where
show EmptyTree = show "Empty"
show (Node (Int, Int) left right) = ..
But get error:
Not in scope: data constructor `Int'
I have a function:
fillTree :: Int -> Tree Int Int -> Tree Int Int
fillTree 1000000 tree = tree
fillTree x tree = let a = treeInsert (x, x) EmptyTree in fillTree (x + 1) a
If i execute it:
No instance for (Show (Tree Int Int))
arising from a use of `print'
How can i make Show instance for my Tree?
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110721/166c26d5/attachment.htm>
More information about the Haskell-Cafe
mailing list