Hoogle Search
Within LTS Haskell 24.49 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
-
massiv Data.Massiv.Array Same as mapIO but with arguments flipped.
forIO_ :: (Load r ix e, MonadUnliftIO m) => Array r ix e -> (e -> m a) -> m ()massiv Data.Massiv.Array Same as mapIO_ but with arguments flipped.
Example
This is the same example as in forM_, with important difference that accumulator ref will be modified concurrently by as many threads as there are capabilities.>>> import Data.Massiv.Array >>> import Data.IORef >>> ref <- newIORef 0 :: IO (IORef Int) >>> forIO_ (range Par (Ix1 0) 1000) $ \ i -> atomicModifyIORef' ref (\v -> (v+i, ())) >>> readIORef ref 499500
-
massiv Data.Massiv.Array Same as mapM except with arguments flipped.
forM_ :: (Source r a, Index ix, Monad m) => Array r ix a -> (a -> m b) -> m ()massiv Data.Massiv.Array 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
-
massiv Data.Massiv.Array Same as iforWS, but without the index.
-
massiv Data.Massiv.Array.Manifest Sequentially loop over the intersection of two mutable arrays while reading elements from both and applying an action to it. There is no mutation to the actual arrays, unless the action itself modifies either one of them.
-
massiv Data.Massiv.Array.Manifest Sequentially loop over a mutable array while modifying each element with an action.
-
massiv Data.Massiv.Array.Manifest Sequentially loop over a mutable array while reading each element and applying an action to it. There is no mutation to the array, unless the action itself modifies it.
forceLazyArray :: (NFData e, Index ix) => Array BL ix e -> Array N ix emassiv Data.Massiv.Array.Manifest O(n) - Evaluate all elements of a boxed lazy array to normal form
-
massiv Data.Massiv.Array.Mutable Sequentially loop over the intersection of two mutable arrays while reading elements from both and applying an action to it. There is no mutation to the actual arrays, unless the action itself modifies either one of them.