modify -package:rio
Monadic state transformer.
Maps an old state to a new state inside a state monad. The old state
is thrown away.
Main> :t modify ((+1) :: Int -> Int)
modify (...) :: (MonadState Int a) => a ()
This says that
modify (+1) acts over any Monad that is a
member of the
MonadState class, with an
Int state.
modify f is an action that updates the state to the
result of applying
f to the current state.
modify f is an action that updates the state to the
result of applying
f to the current state.
modify f is an action that updates the state to the
result of applying
f to the current state.
Monadic state transformer.
Maps an old state to a new state inside a state monad. The old state
is thrown away.
Main> :t modify ((+1) :: Int -> Int)
modify (...) :: (MonadState Int a) => a ()
This says that
modify (+1) acts over any Monad that is a
member of the
MonadState class, with an
Int state.
Transform the value of a field by a function.
Set the label to the result of applying the given function to the
value.
Modify the contents of an
RWVar and return an additional value.
Like
modify_, but allows a value to be returned (β) in addition
to the modified value of the
RWVar.
VS.unpack $ runSTVector (do arr <- new 10 'a'; Monad.mapM_ (\n -> modify arr (mod n 8) succ) [0..10]; return arr)
Modify the elements of a mutable array in-place.
Apply the function to the current state.
modify f ≡ state (\s -> ((), f s))
Apply the function to the current state.
modify f ≡ state (\s -> ((), f s))
Note: this function gets an exclusive access to the state for
its duration.
Replace the state value with the result of applying a function to the
current state value. This is strict in the new state.
modify f = get >>= (put . f $!)
O(1) Modify the element at a given type-safe position using
Finite.
O(1) Modify the element at a given type-safe position using
Finite.
O(1) Modify the element at a given type-safe position using
Finite.
O(1) Modify the element at a given type-safe position using
Finite.
O(1) Modify the element at a given type-safe position using
Finite.
O(1) - Modify an element in the cell of a mutable array with a
supplied action. Returns the previous value, if index was not out of
bounds.
Update all documents in selection using given modifier
Modify each element of an array using the supplied modifier function.
This is an in-place equivalent of an immutable map operation.
Pre-release