
21 Jul
2011
21 Jul
'11
10:45 a.m.
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.