primitive-extras-0.1.12: Extras for the "primitive" library

Safe HaskellNone
LanguageHaskell2010

PrimitiveExtras.Fold

Synopsis

Documentation

indexCounts Source #

Arguments

:: (Integral count, Prim count) 
=> Int

Array size

-> Fold Int (PrimArray count) 

Given a size of the array, construct a fold, which produces an array of index counts.

unliftedArray Source #

Arguments

:: PrimUnlifted element 
=> Int

Size of the array

-> Fold (Int, element) (UnliftedArray element) 

This function is partial in the sense that it expects the index vector of produced elements to be within the specified amount.

primMultiArray :: forall size element. (Integral size, Prim size, Prim element) => PrimArray size -> Fold (Int, element) (PrimMultiArray element) Source #

Having a priorly computed array of inner dimension sizes, e.g., using the indexCounts fold, construct a fold over indexed elements into a multi-array of elements.

Thus it allows to construct it in two passes over the indexed elements.