[Haskell-beginners] A "show" error

Adrien Haxaire adrien at haxaire.org
Sun Mar 11 20:43:13 CET 2012


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



More information about the Beginners mailing list