runState package:fused-effects

Run a State effect starting from the passed value, applying a continuation to the final state and result.
runState k s (pure a) = k s a
runState k s get = k s s
runState k s (put t) = k t ()
Run a State effect starting from the passed value.
runState s (pure a) = pure (s, a)
runState s get = pure (s, s)
runState s (put t) = pure (t, ())
Run a lazy State effect, yielding the result value and the final state. More programs terminate with lazy state than strict state, but injudicious use of lazy state may lead to thunk buildup.
runState s (pure a) = pure (s, a)
runState s get = pure (s, s)
runState s (put t) = pure (t, ())
Run a State effect starting from the passed value.
runState s (pure a) = pure (s, a)
runState s get = pure (s, s)
runState s (put t) = pure (t, ())
Run a State effect starting from the passed IORef. This function is lawless, given that the underlying IORef can be modified by another thread.