You need some type constructor:

data Tree a = Leaf a | Branch (Tree a) (Tree a)

Am 01.01.2009 um 08:32 schrieb Max.cs:

hi all, I want to define a data type Tree a that can either be a or Branch (Tree a) (Tree a)?

I tried

data Tree a = a | Branch (Tree a) (Tree a) deriving Show

but it seems not accpetable in haskell ?

any way I could achieve this ?

Thanks

max
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Attachment: PGP.sig
Description: Signierter Teil der Nachricht

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to