Solution
= Solution
Both versions preserve left-to-right leaf order:
``
flatten :: Tree a -> [a]
flatten (One x) = [x]
flatten (Two l r) = flatten l ++ flatten r
flattenFold :: Tree a -> [a]
flattenFold = foldTree (\x -> [x]) (++)
``
The <tree fold> replaces each leaf by a singleton <list> and each internal node by <list concatenation>. The defining equations of `flattenFold` are consequently those of `flatten`, proving their equality by <structural induction>.