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.

  1. forIO :: forall r ix b r' a m . (Size r', Load r' ix a, Manifest r b, MonadUnliftIO m) => Array r' ix a -> (a -> m b) -> m (Array r ix b)

    massiv Data.Massiv.Array

    Same as mapIO but with arguments flipped.

  2. 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
    

  3. forM :: forall r ix b r' a m . (Source r' a, Manifest r b, Index ix, Monad m) => Array r' ix a -> (a -> m b) -> m (Array r ix b)

    massiv Data.Massiv.Array

    Same as mapM except with arguments flipped.

  4. 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
    

  5. forWS :: forall r ix b r' a s m . (Source r' a, Manifest r b, Index ix, MonadUnliftIO m, PrimMonad m) => WorkerStates s -> Array r' ix a -> (a -> s -> m b) -> m (Array r ix b)

    massiv Data.Massiv.Array

    Same as iforWS, but without the index.

  6. for2PrimM_ :: forall r1 r2 e1 e2 ix m . (PrimMonad m, Index ix, Manifest r1 e1, Manifest r2 e2) => MArray (PrimState m) r1 ix e1 -> MArray (PrimState m) r2 ix e2 -> (e1 -> e2 -> m ()) -> m ()

    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.

  7. forPrimM :: (Manifest r e, Index ix, PrimMonad m) => MArray (PrimState m) r ix e -> (e -> m e) -> m ()

    massiv Data.Massiv.Array.Manifest

    Sequentially loop over a mutable array while modifying each element with an action.

  8. forPrimM_ :: (Manifest r e, Index ix, PrimMonad m) => MArray (PrimState m) r ix e -> (e -> m ()) -> m ()

    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.

  9. forceLazyArray :: (NFData e, Index ix) => Array BL ix e -> Array N ix e

    massiv Data.Massiv.Array.Manifest

    O(n) - Evaluate all elements of a boxed lazy array to normal form

  10. for2PrimM_ :: forall r1 r2 e1 e2 ix m . (PrimMonad m, Index ix, Manifest r1 e1, Manifest r2 e2) => MArray (PrimState m) r1 ix e1 -> MArray (PrimState m) r2 ix e2 -> (e1 -> e2 -> m ()) -> m ()

    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.

Page 62 of many | Previous | Next