Sigh. Ocaml won't show us our own list. So we have to choose an `f`
and a `z` that will turn our handcrafted lists into standard Ocaml
+Sigh. OCaml won't show us our own list. So we have to choose an `f`
+and a `z` that will turn our handcrafted lists into standard OCaml
lists, so that they will print out.
# let cons h t = h :: t;; (* Ocaml is stupid about :: *)
# l'_bind (fun f z > f 1 (f 2 z))
 (fun i > fun f z > f i (f (i+1) z)) cons [];;
 : int list = [1; 2; 2; 3]

+ # let cons h t = h :: t;; (* OCaml is stupid about :: *)
+ # l'_bind (fun f z > f 1 (f 2 z))
+ (fun i > fun f z > f i (f (i+1) z)) cons [];;
+  : int list = [1; 2; 2; 3]
Ta da!
@@ 263,7 +261,7 @@ generalized quantifier `fun pred > pred j` of type `(e > t) > t`.
Let's write a general function that will map individuals into their
corresponding generalized quantifier:
 gqize (x:e) = fun (p:e>t) > p x
+ gqize (x : e) = fun (p : e > t) > p x
This function wraps up an individual in a fancy box. That is to say,
we are in the presence of a monad. The type constructor, the unit and
@@ 271,12 +269,10 @@ the bind follow naturally. We've done this enough times that we won't
belabor the construction of the bind function, the derivation is
similar to the List monad just given:
type 'a continuation = ('a > 'b) > 'b
c_unit (x:'a) = fun (p:'a > 'b) > p x
c_bind (u:('a > 'b) > 'b) (f: 'a > ('c > 'd) > 'd): ('c > 'd) > 'd =
 fun (k:'a > 'b) > u (fun (x:'a) > f x k)

+ type 'a continuation = ('a > 'b) > 'b
+ c_unit (x : 'a) = fun (p : 'a > 'b) > p x
+ c_bind (u : ('a > 'b) > 'b) (f : 'a > ('c > 'd) > 'd) : ('c > 'd) > 'd =
+ fun (k : 'a > 'b) > u (fun (x : 'a) > f x k)
How similar is it to the List monad? Let's examine the type
constructor and the terms from the list monad derived above:
@@ 291,7 +287,7 @@ The unit and the bind for the Montague continuation monad and the
homemade List monad are the same terms! In other words, the behavior
of the List monad and the behavior of the continuations monad are
parallel in a deep sense. To emphasize the parallel, we can
instantiate the type of the list' monad using the Ocaml list type:
+instantiate the type of the list' monad using the OCaml list type:
type 'a c_list = ('a > 'a list) > 'a list

2.11.0