6 ms·
State is modeled in Haskell as the type newtype State s a = State (s -> (a, s)) Where s is the type of your state and a is the type of your result. It's b
by wz1000 11y ago
State is modeled in Haskell as the type
newtype State s a = State (s -> (a, s))
Where s is the type of your state and a is the type of your result. It's basically a function that takes the current state and gives you a result as well as a new state.