[Haskell-beginners] Empty or Tree?
bahadýr altan
doaltan at yahoo.co.uk
Sat Mar 10 11:28:43 CET 2012
Hello everyone. I'm trying to write a code which works on binary trees. When I write code like this with a tree with empty nodes :
data Tree = Empty | Node Integer Tree Tree
function Node a (Node b Empty Empty) (Node c Empty Empty)
it works fine.
But when I try to create a more generic code like this which could work with trees who don't have empty nodes in grandchild level :
function Node a (Node b Tree Tree) (Node c Tree Tree )
I get this error : Undefined data constructor "Tree"
Can you help me with creating more generic code please?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120310/aa5a121d/attachment.htm>
More information about the Beginners
mailing list