
10 Mar
2012
10 Mar
'12
10:28 a.m.
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