-Jacobson-inspired link monad), etc. In this situation, it will be
-enough for now to expect that our reader will expect a function of
-type `int->int`.
-
-<pre>
-type 'a reader = (int->int) -> 'a;; (* mnemonic: e for environment *)
-let reader_unit (x:'a): 'a reader = fun _ -> x;;
-let reader_bind (u: 'a reader) (f:'a -> 'c reader):'c reader = fun e -> f (u e) e;;
-</pre>
-
-It's easy to figure out how to turn an `int` into an `int reader`:
-
-<pre>
-let int2int_reader (x:'a): 'b reader = fun (op:'a -> 'b) -> op x;;
-int2int_reader 2 (fun i -> i + i);;
-- : int = 4
-</pre>
-
-But what do we do when the integers are scattered over the leaves of a
-tree? A binary tree is not the kind of thing that we can apply a
-function of type `int->int` to.
-
-<pre>
-let rec treemonadizer (f:'a -> 'b reader) (t:'a tree):('b tree) reader =
- match t with Leaf x -> reader_bind (f x) (fun x' -> reader_unit (Leaf x'))
- | Node (l, r) -> reader_bind (treemonadizer f l) (fun x ->
- reader_bind (treemonadizer f r) (fun y ->
- reader_unit (Node (x, y))));;
-</pre>
+Jacobson-inspired link monad), etc. In the present case, it will be
+enough to expect that our "environment" will be some function of type
+`int -> int`.
+
+ type 'a reader = (int -> int) -> 'a;; (* mnemonic: e for environment *)
+ let reader_unit (a : 'a) : 'a reader = fun _ -> a;;
+ let reader_bind (u: 'a reader) (f : 'a -> 'b reader) : 'b reader = fun e -> f (u e) e;;
+
+It would be a simple matter to turn an *integer* into an `int reader`:
+
+ let int_readerize : int -> int reader = fun (a : int) -> fun (modifier : int -> int) -> modifier a;;
+ int_readerize 2 (fun i -> i + i);;
+ - : int = 4
+
+But how do we do the analagous transformation when our `int`s are scattered over the leaves of a tree? How do we turn an `int tree` into a reader?
+A tree is not the kind of thing that we can apply a
+function of type `int -> int` to.
+
+But we can do this:
+
+ let rec tree_monadize (f : 'a -> 'b reader) (t : 'a tree) : 'b tree reader =
+ match t with
+ | Leaf i -> reader_bind (f i) (fun i' -> reader_unit (Leaf i'))
+ | Node (l, r) -> reader_bind (tree_monadize f l) (fun x ->
+ reader_bind (tree_monadize f r) (fun y ->
+ reader_unit (Node (x, y))));;