- | Leaf i -> continuation_bind (f i) (fun i' -> continuation_unit (Leaf i'))
- | Node (l, r) -> continuation_bind (treemonadizer f l) (fun x ->
- continuation_bind (treemonadizer f r) (fun y ->
- continuation_unit (Node (x, y))));;
+ | Leaf a -> continuation_bind (f a) (fun b -> continuation_unit (Leaf b))
+ | Node (l, r) -> continuation_bind (tree_monadize f l) (fun l' ->
+ continuation_bind (tree_monadize f r) (fun r' ->
+ continuation_unit (Node (l', r'))));;
+
+We use the Continuation monad described above, and insert the
+`continuation` type in the appropriate place in the `tree_monadize` code. Then if we give the `tree_monadize` function an operation that converts `int`s into `'b`-wrapping Continuation monads, it will give us back a way to turn `int tree`s into corresponding `'b tree`-wrapping Continuation monads.