class ActionState s m where
mhas a state variable of type
get *> ma = ma
ma <* get = ma
put a >>= get = put a $> a
put a *> put b = put b
(,) <$> get <*> get = get <&> \a -> (a, a)
Informally, these rules mean it behaves like an ordinary assignable variable: it doesn’t magically change value by looking at it, if you put a value there that’s always the value you’ll get if you read it, assigning a value but never reading that value has no effect, and so on.
: m s
Fetch the current value of the state variable.
: s -> m ()
Set the value of the state variable.
: (s -> s) -> m ()
Modify the state variable with the given function.
default modify: Action m => (s -> s) -> m ()