A part of the HalogenF
algebra that replicates a MonadState
-like
interface.
data StateF s a
= Get (s -> a)
| Modify (s -> s) a
The state algebra.
instance functorStateF :: Functor (StateF s)
mapState :: forall s t a. (t -> s) -> ((s -> s) -> t -> t) -> StateF s a -> StateF t a
Map over the state value using a function to extract the new state value from the old state, and a function for modifying the state.
stateN :: forall s m. (Monad m, MonadState s m) => Natural (StateF s) m
A natural transformation for interpreting the state algebra as some
MonadState
-supporting monad. Used internally by Halogen.