
1 Jan
2009
1 Jan
'09
4:58 a.m.
hi Bob,
I believe the type of foldTree is implementable, but what confuses me is
the output example:
concatT (Leaf t) = t concatT (Branch (Leaf t1) (Leaf t2)) = Branch t1 t2
they seem to be inconsistent with the type of concatT which return a Tree only, but in the Leaf case, a atomic value is returned?
anything important I am missing?
You need to remember what type is stored in that Leaf – remember that this is a Tree (Tree a) – i.e. the variable t in the line above has the type Tree a. Bob