You need to provide a Show instance for your data type. The easiest way is to add 'deriving Show' at the end of your data type declaration.
These are the ones I get, they are the same but they have different inputs :Main> f (Branch 12 (Branch 7 (Branch 3 Empty Empty) (Branch 10 Empty Empty)) (Branch 24 Empty Empty))ERROR - Cannot find "show" function for:*** Expression : f (Branch 12 (Branch 7 (Branch 3 Empty Empty) (Branch 10 Empty Empty)) (Branch 24 Empty Empty))*** Of type : (Integer,Integer,Tree,Tree,Integer,Tree,Tree)Main> f (Branch 13 (Branch 2 Empty Empty) (Branch 48 Empty Empty))ERROR - Cannot find "show" function for:*** Expression : f (Branch 13 (Branch 2 Empty Empty) (Branch 48 Empty Empty))*** Of type : (Integer,Integer,Tree,Tree,Integer,Tree,Tree)To be clear, I need to get a tree as an input. I mean the output should be like this :f (Branch a (Branch b (Branch d Empty Empty) (Branch e Empty Empty)) (Branch c Empty Empty)) = Branch b (Branch d Empty Empty) (Branch a (Branch e Empty Empty) (Branch c Empty Empty))Thank you very much for helping me I really appreciate it :)Sent: Sunday, 11 March 2012, 17:50
From: Ozgur Akgun <ozgurakgun@gmail.com>
To: bahadýr altan <doaltan@yahoo.co.uk>; Haskell Beginners <beginners@haskell.org>
Subject: Re: [Haskell-beginners] Type Tree variables
What's the error you get?On 11 March 2012 15:37, bahadýr altan <doaltan@yahoo.co.uk> wrote:
I tried "f" function but it always give errors. Thanks anyway..
Ozgur