Copyright | (c) 2020 Composewell Technologies |
---|---|
License | BSD-3-Clause |
Maintainer | streamly@composewell.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- module Streamly.Internal.Data.Array.Mut.Type
- splitOn :: (MonadIO m, Unbox a) => (a -> Bool) -> MutArray a -> Stream m (MutArray a)
- genSlicesFromLen :: forall m a. (Monad m, Unbox a) => Int -> Int -> Unfold m (MutArray a) (Int, Int)
- getSlicesFromLen :: forall m a. (Monad m, Unbox a) => Int -> Int -> Unfold m (MutArray a) (MutArray a)
- fromStream :: (MonadIO m, Unbox a) => Stream m a -> m (MutArray a)
Documentation
splitOn :: (MonadIO m, Unbox a) => (a -> Bool) -> MutArray a -> Stream m (MutArray a) Source #
Split the array into a stream of slices using a predicate. The element matching the predicate is dropped.
Pre-release
:: forall m a. (Monad m, Unbox a) | |
=> Int | from index |
-> Int | length of the slice |
-> Unfold m (MutArray a) (Int, Int) |
Generate a stream of array slice descriptors ((index, len)) of specified length from an array, starting from the supplied array index. The last slice may be shorter than the requested length depending on the array length.
Pre-release
:: forall m a. (Monad m, Unbox a) | |
=> Int | from index |
-> Int | length of the slice |
-> Unfold m (MutArray a) (MutArray a) |
Generate a stream of slices of specified length from an array, starting from the supplied array index. The last slice may be shorter than the requested length depending on the array length.
Pre-release
fromStream :: (MonadIO m, Unbox a) => Stream m a -> m (MutArray a) Source #
Create an Array
from a stream. This is useful when we want to create a
single array from a stream of unknown size. writeN
is at least twice
as efficient when the size is already known.
Note that if the input stream is too large memory allocation for the array
may fail. When the stream size is not known, chunksOf
followed by
processing of indvidual arrays in the resulting stream should be preferred.
Pre-release