[Haskell-beginners] A "show" error

bahadýr altan doaltan at yahoo.co.uk
Sun Mar 11 21:00:34 CET 2012


I use Hugs.  And I must use it...


________________________________
 From: Ozgur Akgun <ozgurakgun at gmail.com>
To: bahadýr altan <doaltan at yahoo.co.uk> 
Cc: "beginners at haskell.org" <beginners at haskell.org> 
Sent: Sunday, 11 March 2012, 21:26
Subject: Re: [Haskell-beginners] A "show" error
 

Hi again,

What interpreter do you use? With ghci, I don't get any errors.

*Main> f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
(12,15,Empty,Empty,28,Empty,Empty)

On 11 March 2012 19:10, bahadýr altan <doaltan at yahoo.co.uk> wrote:

Hi, 
>I'm trying to process on a tree with this function :
>
>
>f (Branch x (Branch y y1 y2) (Branch z z1 z2)) = (x,y,y1,y2,z,z1,z2)
>
>
>
>and my tree declaration is this : 
>
>
>data Tree = Empty | Branch Integer Tree Tree deriving (Show)
>
>
>And I'm getting this error : 
>
>
>Main> f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
>ERROR - Cannot find "show" function for:
>*** Expression : f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty))
>*** Of type    : (Integer,Integer,Tree,Tree,Integer,Tree,Tree)
>
>
>I'll be happy if you help me to get rid of this error..
-- 
Ozgur Akgun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120311/9224ef16/attachment.htm>


More information about the Beginners mailing list