# 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:
... >> 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 >>= ...