
On 31 Dec 2008, at 21:18, Henk-Jan van Tuyl wrote:
On Wed, 31 Dec 2008 17:19:09 +0100, Max cs
wrote: Hi Henk-Jan van Tuyl,
Thank you very much for your reply!
I think the concatenation should be different to thhe
treeConcat :: Tree a -> Tree a -> Tree a
the above is a combination of two trees instead of a concatenation, so I think the type of treeConcat should be:
treeConcat :: Tree (Tree a) -> Tree a
instead. How do you think? : ) I tried to implement it .. but it seems confusing.. to me
Thanks
Max
Hello Max,
The function treeConcat :: Tree (Tree a) -> Tree a cannot be created, as it has an infinite type;
It does? How did he type it then? And yes, it can be created concatT :: Tree (Tree a) -> Tree a concatT (Leaf t) = t concatT (Branch l r) = Branch (concatT l) (concatT r) It's also known as join on trees (as I explained a bit more in my response on haskell-beginners). Bob