X-Git-Url: http://lambda.jimpryor.net/git/gitweb.cgi?p=lambda.git;a=blobdiff_plain;f=state_monad_tutorial.mdwn;h=65020143dd370ca10e319f4d7bc51858e50ab9b6;hp=bac9124e828bfd6a571ffe0fd8c48591510afa53;hb=336590c5e10edd92eacf93d0ff04dfe93e0d376a;hpb=e4a25b6b413f5e536393226994c171685e50c797 diff --git a/state_monad_tutorial.mdwn b/state_monad_tutorial.mdwn index bac9124e..65020143 100644 --- a/state_monad_tutorial.mdwn +++ b/state_monad_tutorial.mdwn @@ -100,8 +100,8 @@ Here is how you'd have to do it using our OCaml monad library: # let increment_store'' : ('x,'a) S.m = S.(get >>= fun cur -> let value = cur.total - in let s = { total = succ cur.total; modifications = succ cur.modifications } - in put s >> unit value);; + in let s' = { total = succ cur.total; modifications = succ cur.modifications } + in put s' >> unit value);; Let's try it out: @@ -170,7 +170,7 @@ What are the special-purpose operations that the `State_monad` module defines fo ... >> put new_store >> fun () -> ... - As that code snippets suggests, the boxed value after the application of `puts new_store` is just `()`. If you want to preserve the existing boxed value but replace the store, do this: + As that code snippet suggests, the boxed value after the application of `puts new_store` is just `()`. If you want to preserve the existing boxed value but replace the store, do this: ... >>= fun value -> put new_store >> unit value >>= ...