forM_ -package:matrices
base Control.Monad Data.Foldable,
base-compat Control.Monad.Compat,
protolude Protolude,
relude Relude.Foldable.Reexport,
base-prelude BasePrelude,
ihaskell IHaskellPrelude,
numhask NumHask.Prelude,
base-compat-batteries Control.Monad.Compat,
Agda Agda.Utils.Monad,
ghc-internal GHC.Internal.Control.Monad GHC.Internal.Data.Foldable,
rebase Rebase.Prelude,
persistent-test Init forM_ is
mapM_ with its arguments flipped. For a version
that doesn't ignore the results see
forM.
forM_ is just like
for_, but specialised to monadic
actions.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
O(n) Apply the monadic action to every element of the vector,
discarding the results. It's the same as flip mapM_.
O(n) Apply the monadic action to every element of the vector,
discarding the results. It's the same as flip mapM_.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
O(n) Apply the monadic action to every element of the vector,
discarding the results. It's the same as flip mapM_.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
O(n) Apply the monadic action to every element of the vector,
discarding the results. It's the same as flip mapM_.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
O(n) Apply the monadic action to every element of the vector,
discarding the results. It's the same as flip mapM_.
form element or form attribute
forM_ is
mapM_ with its arguments flipped. For a version
that doesn't ignore the results see
forM.
As of base 4.8.0.0,
forM_ is just
for_, specialized to
Monad.
forM_ is
mapM_ with its arguments flipped. For a version
that doesn't ignore its results, see
forM.
Like
forM_, but applying the function to the individual list
items in parallel.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
O(n) Apply the monadic action to all elements of a vector and
ignore the results. Equivalent to
flip mapM_.
Just like
mapM_, except with flipped arguments.
Examples
Here is a common way of iterating N times using a for loop in an
imperative language with mutation being an obvious side effect:
>>> import Data.Massiv.Array as A
>>> import Data.IORef
>>> ref <- newIORef 0 :: IO (IORef Int)
>>> A.forM_ (range Seq (Ix1 0) 1000) $ \ i -> modifyIORef' ref (+i)
>>> readIORef ref
499500
forM_ is
mapM_ with its arguments flipped. For a version
that doesn't ignore the results see
forM.
Same as
mapM_ with arguments flipped