[Haskell-cafe] definition of data

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Thu Jan 1 02:35:55 EST 2009

On 2009 Jan 1, at 2:32, Max.cs wrote:
> data Tree a = a | Branch (Tree a) (Tree a) deriving Show
> but it seems not accpetable in haskell ?

You need a constructor in both legs of the type:

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

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090101/8ddd680d/attachment.htm

More information about the Haskell-Cafe mailing list