Propagation of State Monad

孤街浪徒 提交于 2019-12-03 17:13:44

Here's one way of thinking about it: runState requires an initial state as its parameter. Where is this initial state available in your code? That's how far the state monad needs to propagate.

Note that runState encapsulates the stateful computation, so that if you have two runState computations side-by-side, they won't see each other's states (unless you pass the result from one to the other.) This also should give you a hint how far "up" the runState needs to be.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!