
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..

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
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

On Sun, Mar 11, 2012 at 07:26:02PM +0000, Ozgur Akgun wrote:
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)
Hi, Me neither, no error on GHCi 7.4.1 on ArchLinux. Prelude> data Tree = Empty | Branch Integer Tree Tree deriving (Show) Prelude> let f (Branch x (Branch y y1 y2) (Branch z z1 z2)) = (x,y,y1,y2,z,z1,z2) Prelude> f (Branch 12 (Branch 15 Empty Empty) (Branch 28 Empty Empty)) (12,15,Empty,Empty,28,Empty,Empty) HTH, Adrien -- Adrien Haxaire www.adrienhaxaire.org | @adrienhaxaire

I use Hugs. And I must use it...
________________________________
From: Ozgur Akgun
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

On Sun, Mar 11, 2012 at 16:00, bahadýr altan
I use Hugs. And I must use it...
That's ... unfortunate. Use smaller tuples, then; I believe 6 is the limit for its Show and Read instances. Or define your own result ADT and derive a Show instance for it. -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms

Is 6 actually a limit, or is that just what is already defined? Could
a new Show instance for 7-tuples be defined?
On Mon, Mar 12, 2012 at 9:20 AM, Brandon Allbery
On Sun, Mar 11, 2012 at 16:00, bahadýr altan
wrote: I use Hugs. And I must use it...
That's ... unfortunate. Use smaller tuples, then; I believe 6 is the limit for its Show and Read instances. Or define your own result ADT and derive a Show instance for it.
-- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On Wed, Apr 11, 2012 at 18:49, Lyndon Maydwell
Is 6 actually a limit, or is that just what is already defined? Could a new Show instance for 7-tuples be defined?
It can be defined, it's just a pain in the butt. GHC predefines Show for up to something like 15-tuples, I think. -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms

On Sun, Mar 11, 2012 at 07:10:28PM +0000, bahadýr altan 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..
Hello, Dit you try to derive it automatically, by adding 'deriving (Show)' after its declaration? Otherwise you need to define it manually I'm afraid. -- Adrien Haxaire www.adrienhaxaire.org | @adrienhaxaire

Oh sorry I just realized you did ! On Sun, Mar 11, 2012 at 07:10:28PM +0000, bahadýr altan 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..
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
-- Adrien Haxaire www.adrienhaxaire.org | @adrienhaxaire

On Sun, Mar 11, 2012 at 15:10, bahadýr altan
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)
Hugs apparently doesn't have a Show instance for 7-tuples. Note that Hugs is quite old and not very well supported at this point; you should probably be using ghc / ghci instead. -- brandon s allbery allbery.b@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms
participants (5)
-
Adrien Haxaire
-
bahadýr altan
-
Brandon Allbery
-
Lyndon Maydwell
-
Ozgur Akgun