Proposal: Add a catamorphism on Trees

David Feuer david.feuer at
Tue May 17 21:03:31 UTC 2016

Daniel Wagner would like to add the following straightforward function
to Data.Tree. I think this is a grand idea.

foldTree :: (a -> [b] -> b) -> Tree a -> b
foldTree f = go
    go (Node x ts) = f x (map go ts)

More information about the Libraries mailing list