post links to state monad tutorial
[lambda.git] / monad_library.mdwn
index 398f2e5..36b6962 100644 (file)
@@ -80,17 +80,17 @@ Some comments on the design of this library.
 
 *      The monads available are:
 
-       *       Identity_monad
-       *       Maybe_monad
-       *       List_monad
-       *       Reader_monad (has to be parameterized as above)
-       *       State_monad (has to be parameterized as above)
-       *       Ref_monad (a version of State_monad with a structured store, and custom operations for creating new cells in the store, and getting or changing the values of existing cells)
-       *       Writer_monad (has to be parameterized on the type of the written data; use Writer1 as a simple predefined case)
-       *       Error_monad, with `throw err` and `catch u handler_function` operations (this has to be parameterized on the type of `err`; use Failure as a simple predefined case, where `type err = string`)
-       *       IO_monad (you don't need this in OCaml, but it works analagously to the IO monad in Haskell, so it's handy for working with Haskell-written algorithms in OCaml)
-       *       Leaf_monad (leaf-labeled, binary trees)
-       *       and of course, Continuation_monad, with `callcc`, `reset`, `shift` and `abort` operations.
+       *       `Identity_monad`
+       *       `Maybe_monad`
+       *       `List_monad`
+       *       `Reader_monad` (has to be parameterized as above)
+       *       `State_monad` (has to be parameterized as above)
+       *       `Ref_monad` (a version of `State_monad` with a structured store, and custom operations for creating new cells in the store, and getting or changing the values of existing cells)
+       *       `Writer_monad` (has to be parameterized on the type of the written data; use `Writer1` as a simple predefined case)
+       *       `Error_monad`, with `throw err` and `catch u handler_function` operations (this has to be parameterized on the type of `err`; use `Failure` as a simple predefined case, where `type err = string`)
+       *       `IO_monad` (you don't need this in OCaml, but it works analagously to the `IO` monad in Haskell, so it's handy for working with Haskell-written algorithms in OCaml)
+       *       `Leaf_monad` (leaf-labeled, binary trees)
+       *       and of course, `Continuation_monad`, with `callcc`, `reset`, `shift` and `abort` operations.
 
 *      All of these monads come with [[monad transformers]] too. To get a State monad wrapped around a Maybe monad, do this:
 
@@ -101,7 +101,7 @@ Some comments on the design of this library.
 
                module MS = Maybe_monad.T(S);;
 
-       Note that those two layered monads will have slightly different behavior. See our discussion of [[monad transformers]] for details. Also, the outermost monad is the one whose operations are most exposed. If you want to use any of the State-specific operations (like `puts succ`) in the `MS` monad, you'll have to "lift" those operations into the MaybeT interface. The way you do that is like this:
+       Note that those two layered monads will have slightly different behavior. See our discussion of [[monad transformers]] for details. Also, the outermost monad is the one whose operations are most exposed. If you want to use any of the State-specific operations (like `puts succ`) in the `MS` monad, you'll have to "elevate" those operations into the MaybeT interface. The way you do that is like this:
 
                MS.(... >> elevate (S.puts succ) >> ...)
 
@@ -112,7 +112,7 @@ Some comments on the design of this library.
                # let u = S.(unit 1);;
                val u : ('_a, int) S.m = <abstr>
 
-       You'll notice that the monadic type `S.m` is parameterized on *two* type arguments: one of them, `int`, is the type of the wrapped value. What is the other one (`'_a' in the above example)?
+       You'll notice that the monadic type `S.m` is parameterized on *two* type arguments: one of them, `int`, is the type of the wrapped value. What is the other one (`'_a` in the above example)?
 
        The answer is that for most of the monads this second type argument is an idle wheel. The Continuation monad needs both of the type arguments, though, since its monadic type is implemented as: