modify

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.
Modify the state.
Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise.
modify (\v -> write v 0 'x') (replicate 3 'a') = <'x','a','a'>
Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise.
modify (\v -> write v 0 'x') (replicate 3 'a') = <'x','a','a'>
Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise.
modify (\v -> write v 0 'x') (replicate 3 'a') = <'x','a','a'>
Apply a destructive operation to a vector. The operation will be performed in place if it is safe to do so and will modify a copy of the vector otherwise.
modify (\v -> write v 0 'x') (replicate 3 'a') = <'x','a','a'>
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))
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.