[[!toc]]
-
Manipulating trees with monads
------------------------------
-This thread develops an idea based on a detailed suggestion of Ken
+This topic develops an idea based on a detailed suggestion of Ken
Shan's. We'll build a series of functions that operate on trees,
doing various things, including replacing leaves, counting nodes, and
converting a tree to a list of leaves. The end result will be an
From an engineering standpoint, we'll build a tree transformer that
deals in monads. We can modify the behavior of the system by swapping
-one monad for another. (We've already seen how adding a monad can add
+one monad for another. We've already seen how adding a monad can add
a layer of funtionality without disturbing the underlying system, for
instance, in the way that the reader monad allowed us to add a layer
of intensionality to an extensional grammar, but we have not yet seen
-the utility of replacing one monad with other.)
+the utility of replacing one monad with other.
First, we'll be needing a lot of trees during the remainder of the
course. Here's a type constructor for binary trees: