Haskell 状态Monad (State Monad)的理解

一、State s a数据类型 State s a是一种用来封装状态处理函数:\s -> (a,s’)的数据结构,由于State封装的是一个函数,而不是状态s自己,因此称State为State类型(type)是不许确的,应该把State s a称为状态处理器(State processor)。web newtype State s a = State { runState :: s -> (a,s
相关文章
相关标签/搜索