[Haskell-beginners] Type Tree variables
Ozgur Akgun
ozgurakgun at gmail.com
Sun Mar 11 17:04:50 CET 2012
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.
The errors you get aren't to do with the function f.
On 11 March 2012 16:01, bahadýr altan <doaltan at yahoo.co.uk> wrote:
> 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 :)
>
> ------------------------------
> *From:* Ozgur Akgun <ozgurakgun at gmail.com>
> *To:* bahadýr altan <doaltan at yahoo.co.uk>; Haskell Beginners <
> beginners at haskell.org>
> *Sent:* Sunday, 11 March 2012, 17:50
>
> *Subject:* Re: [Haskell-beginners] Type Tree variables
>
> What's the error you get?
>
> On 11 March 2012 15:37, bahadýr altan <doaltan at yahoo.co.uk> wrote:
>
> I tried "f" function but it always give errors. Thanks anyway..
>
>
> Ozgur
>
>
>
--
Ozgur Akgun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120311/d603b72b/attachment.htm>
More information about the Beginners
mailing list