Copyright | (c) 2019 Composewell Technologies |
---|---|
License | BSD3 |
Maintainer | streamly@composewell.com |
Stability | experimental |
Portability | GHC |
Safe Haskell | None |
Language | Haskell2010 |
Combinators to efficiently manipulate streams of arrays.
Synopsis
- arraysOf :: (IsStream t, MonadIO m, Storable a) => Int -> t m a -> t m (Array a)
- concat :: (IsStream t, MonadIO m, Storable a) => t m (Array a) -> t m a
- concatRev :: (IsStream t, MonadIO m, Storable a) => t m (Array a) -> t m a
- interpose :: (MonadIO m, IsStream t, Storable a) => a -> t m (Array a) -> t m a
- interposeSuffix :: (MonadIO m, IsStream t, Storable a) => a -> t m (Array a) -> t m a
- intercalateSuffix :: (MonadIO m, IsStream t, Storable a) => Array a -> t m (Array a) -> t m a
- splitOn :: (IsStream t, MonadIO m) => Word8 -> t m (Array Word8) -> t m (Array Word8)
- splitOnSuffix :: (IsStream t, MonadIO m) => Word8 -> t m (Array Word8) -> t m (Array Word8)
- compact :: (MonadIO m, Storable a) => Int -> SerialT m (Array a) -> SerialT m (Array a)
- toArray :: (MonadIO m, Storable a) => SerialT m (Array a) -> m (Array a)
Creation
arraysOf :: (IsStream t, MonadIO m, Storable a) => Int -> t m a -> t m (Array a) Source #
arraysOf n stream
groups the elements in the input stream into arrays of
n
elements each.
Same as the following but more efficient:
arraysOf n = S.chunksOf n (A.writeN n)
Since: 0.7.0
Flattening to elements
concat :: (IsStream t, MonadIO m, Storable a) => t m (Array a) -> t m a Source #
Convert a stream of arrays into a stream of their elements.
Same as the following but more efficient:
concat = S.concatMap A.read
Since: 0.7.0
concatRev :: (IsStream t, MonadIO m, Storable a) => t m (Array a) -> t m a Source #
Convert a stream of arrays into a stream of their elements reversing the contents of each array before flattening.
Since: 0.7.0
interpose :: (MonadIO m, IsStream t, Storable a) => a -> t m (Array a) -> t m a Source #
Flatten a stream of arrays after inserting the given element between arrays.
Internal
interposeSuffix :: (MonadIO m, IsStream t, Storable a) => a -> t m (Array a) -> t m a Source #
Flatten a stream of arrays appending the given element after each array.
Since: 0.7.0
intercalateSuffix :: (MonadIO m, IsStream t, Storable a) => Array a -> t m (Array a) -> t m a Source #
Transformation
splitOn :: (IsStream t, MonadIO m) => Word8 -> t m (Array Word8) -> t m (Array Word8) Source #
Split a stream of arrays on a given separator byte, dropping the separator and coalescing all the arrays between two separators into a single array.
Since: 0.7.0
splitOnSuffix :: (IsStream t, MonadIO m) => Word8 -> t m (Array Word8) -> t m (Array Word8) Source #
compact :: (MonadIO m, Storable a) => Int -> SerialT m (Array a) -> SerialT m (Array a) Source #
Coalesce adjacent arrays in incoming stream to form bigger arrays of a maximum specified size in bytes.
Since: 0.7.0