3 ms·
Can State not be considered as an immutable infinite list, indexed by time ? Does Haskell have a forgettable concept ? State could then be a forgettable infin
by deepnet 11y ago
Can State not be considered as an immutable infinite list, indexed by time ?
Does Haskell have a forgettable concept ?
State could then be a forgettable infinite list rather than a side/effect.
- wz1000 11y agoState 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.