| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
PrimitiveExtras.Fold
Synopsis
- indexCounts :: (Integral count, Prim count) => Int -> Fold Int (PrimArray count)
- unliftedArray :: PrimUnlifted element => Int -> Fold (Int, element) (UnliftedArray element)
- primMultiArray :: forall size element. (Integral size, Prim size, Prim element) => PrimArray size -> Fold (Int, element) (PrimMultiArray element)
Documentation
Given a size of the array, construct a fold, which produces an array of index counts.
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.