withState -package:massiv
mtl Control.Monad.State.Lazy Control.Monad.State.Strict,
transformers Control.Monad.Trans.State.Lazy Control.Monad.Trans.State.Strict,
protolude Protolude,
relude Relude.Monad.Reexport,
rio RIO.State,
monads-tf Control.Monad.State.Lazy Control.Monad.State.Strict,
universum Universum.Monad.Reexport,
rebase Rebase.Prelude,
mtl-prelude MTLPrelude,
dunai Control.Monad.Trans.MSF.State,
monadology Control.Monad.Ology.Specific.StateT withState f m executes action
m on a state
modified by applying
f.
>>> runPureEff $ withState 10 $ \st -> do
n <- get st
pure (s -> (2 * n, s))
(20,10)
>>> runPureEff $ withState 10 $ \st -> do
n <- get st
pure (s -> (2 * n, s))
(20,10)
withStateT f m executes action
m on a state
modified by applying
f.
withStateT f m executes action
m on a state
modified by applying
f.
Opens a prepared statement, executes an action using this statement,
and closes the statement, even in the presence of exceptions.
Set a flag in the parser to True before running a parser,
then set the flag's value to False.
Evaluate the inner monad of a stream using the supplied stateful
runner function and the initial state. The state returned by an
invocation of the runner is supplied as input state to the next
invocation.
Run a stateful parser with some initial state on a text. See also:
runTextParser, runJournalParser.