[Haskell-cafe] help in tree folding

patrik osgnach patrik.osgnach at gmail.com
Tue May 6 08:20:04 EDT 2008

Hi. I'm learning haskell but i'm stuck on a generic tree folding 
exercise. i must write a function of this type
treefoldr::(Eq a,Show a)=>(a->b->c)->c->(c->b->b)->b->Tree a->c
Tree has type
data (Eq a,Show a)=>Tree a=Void | Node a [Tree a] deriving (Eq,Show)
as an example treefoldr (:) [] (++) [] (Node '+' [Node '*' [Node 'x' [], 
Node 'y' []], Node 'z' []])
must return "+∗xyz"
any help?
(sorry for my bad english)

More information about the Haskell-Cafe mailing list