Signed-off-by: Jim Pryor <profjim@jimpryor.net>
<pre>
type 'a intension = s -> 'a;;
let unit x = fun (w:s) -> x;;
-let bind u f = fun (w:s) -> f (u w) w;;
+(* as before, bind can be written more compactly, but having
+ it spelled out like this will be useful down the road *)
+let bind u f = fun (w:s) -> let a = u w in let u' = f a in u' w;;
</pre>
Then the individual concept `unit ann` is a rigid designator: a
(* here's our bind operation; how does it work? *)
let bind (u : 'a reader) (f: 'a -> 'b reader) : 'b reader =
- fun (e : env) -> f (u e) e
+ (* this can be written more compactly, but having it spelled out
+ like this will be useful down the road *)
+ fun (e : env) -> let a = u e in let u' = f a in u' e
+
(* we also define two special-purpose operations on our reader-monad values *)