X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?a=blobdiff_plain;f=topics%2F_week8_reader_monad.mdwn;h=af47b3d27ca84e06794d2021a16d2f98218b40e3;hb=d029b9cc1e11df56ea4494a5348d09f61b344586;hp=557bd2f911ef675c96888ebba642733c189744b9;hpb=0dbabab6a530251142a18a6fc2de5c2cb4f731f2;p=lambda.git diff --git a/topics/_week8_reader_monad.mdwn b/topics/_week8_reader_monad.mdwn index 557bd2f9..af47b3d2 100644 --- a/topics/_week8_reader_monad.mdwn +++ b/topics/_week8_reader_monad.mdwn @@ -19,12 +19,12 @@ The starting point was to allow the division function to return an int option instead of an int. If we divide 6 by 2, we get the answer Just 3. But if we divide 6 by 0, we get the answer Nothing. -The next step was to adjust the other arithmetic functions to know how -to handle receiving Nothing instead of a (boxed) integer. This meant +The next step was to adjust the other arithmetic functions to teach them what to do if they received Nothing instead of a boxed integer. +This meant changing the type of their input from ints to int options. But we didn't need to do this piecemeal; rather, we could "lift" the ordinary arithmetic operations into the monad using the various tools provided -by the monad. +by the monad. We'll go over this lifting operation in detail in the next section. ## Tracing the effect of safe-div on a larger computation @@ -149,7 +149,7 @@ is the ⇧ and the map2 function from the notes on safe division: | Some y -> Some (g x y));; Then we lift the entire computation into the monad by applying ⇧ to -the integers, and by applying `map1` to the operators: +the integers, and by applying `map2` to the operators:
 \tree ((((map2 +) (⇧1)) (((map2 *) (((map2 /) (⇧6)) (⇧0))) (⇧4))))
@@ -654,4 +654,4 @@ what is happening in world 2, where Cam doesn't leave.
  (using bind), and the non-intersective adjectives will take
  intensional arguments.
 
-
+notes: cascade, general env