HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulestreamly-core-0.2.2Haskell2010

Streamly.Internal.Data.MutArray.Stream

Deprecated. Please use Streamly.Internal.Data.MutArray instead.

Combinators to efficiently manipulate streams of mutable arrays.

We can either push these in the MutArray module with a "chunks" prefix or keep this as a separate module and release it.

  • 1 type
  • 13 values

Generation

4 declarations
valuechunksOf
  1. :: (MonadIO m, Unbox a)
  2. => Int
  3. -> Stream m a
  4. -> Stream m (MutArray a)
#

chunksOf n stream groups the elements in the input stream into arrays of n elements each.

Same as the following but may be more efficient:

Example1 expression
chunksOf n = Stream.foldMany (MutArray.createOf n)

Pre-release

Compaction

7 declarations
valuepackArraysChunksOf
  1. :: (MonadIO m, Unbox a)
  2. => Int
  3. -> Stream m (MutArray a)
  4. -> Stream m (MutArray a)
#

This mutates the first array (if it has space) to append values from the second one. This would work for immutable arrays as well because an immutable array never has space so a new array is allocated instead of mutating it.

| Coalesce adjacent arrays in incoming stream to form bigger arrays of a maximum specified size. Note that if a single array is bigger than the specified size we do not split it to fit. When we coalesce multiple arrays if the size would exceed the specified size we do not coalesce therefore the actual array size may be less than the specified chunk size.

Elimination

3 declarations