(Chapter 7 of The Haskell School of Expression is about trees.)
The first definition is of a tree with values stored only at the leaves, i.e.
data Tree a = Leaf a | Branch (Tree a) (Tree a)
It then gives a mapTree function (equivalent to map on a list), which is trivial, and functions fringe, treeSize and treeHeight, which return respectively
(
Read more... )