primitive-extras- Extras for the "primitive" library
Safe HaskellNone




indexCounts Source #


:: (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 #


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