Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data PushVector a where
- type PushVector1 a = PushVector (Data a)
- freezePush :: Syntax a => PushVector a -> Data [Internal a]
- freezeToVector :: Syntax a => PushVector a -> Vector a
- thawPush :: Syntax a => Data [Internal a] -> PushVector a
- class Pushy arr where
- toPush :: Syntax a => arr a -> PushVector a
- (++) :: (Pushy arr1, Pushy arr2, Syntax a) => arr1 a -> arr2 a -> PushVector a
- unpair :: (Pushy arr, Syntax a) => arr (a, a) -> PushVector a
- unpairWith :: (Pushy arr, Syntax a) => ((Data Index -> a -> M ()) -> Data Index -> (a, a) -> M ()) -> arr (a, a) -> PushVector a
- everyOther :: (Data Index -> a -> M b) -> Data Index -> (a, a) -> M b
- zipUnpair :: Syntax a => Vector a -> Vector a -> PushVector a
- class Ixmap arr where
- reverse :: (Ixmap arr, Len arr, Syntax a) => arr a -> arr a
- halve :: Syntax a => Vector a -> (Vector a, Vector a)
- riffle :: Syntax a => Vector a -> PushVector a
- class Len arr where
- chunk :: (Pushy arr1, Pushy arr2, Syntax b) => Data Length -> (Vector a -> arr1 b) -> (Vector a -> arr2 b) -> Vector a -> PushVector b
- scanl :: (Syntax a, Syntax b) => (a -> b -> a) -> a -> Vector b -> PushVector a
- empty :: PushVector a
- flatten :: Syntax a => Vector (PushVector a) -> PushVector a
Documentation
data PushVector a where Source
Functor PushVector | |
Len PushVector | |
Ixmap PushVector | |
Pushy PushVector | |
Syntax a => Syntactic (PushVector a) | |
type Internal (PushVector a) = [Internal a] | |
type Domain (PushVector a) = FeldDomain |
type PushVector1 a = PushVector (Data a) Source
freezePush :: Syntax a => PushVector a -> Data [Internal a] Source
Store push vectors in memory.
freezeToVector :: Syntax a => PushVector a -> Vector a Source
Store a push vector to memory and return it as an ordinary vector.
thawPush :: Syntax a => Data [Internal a] -> PushVector a Source
Create a push vector from an array stored in memory.
Any kind of vector, push or pull, can cheaply be converted to a push vector
toPush :: Syntax a => arr a -> PushVector a Source
(++) :: (Pushy arr1, Pushy arr2, Syntax a) => arr1 a -> arr2 a -> PushVector a Source
Concatenating two arrays.
unpair :: (Pushy arr, Syntax a) => arr (a, a) -> PushVector a Source
Given an array of pairs, flatten the array so that the elements of the pairs end up next to each other in the resulting vector.
unpairWith :: (Pushy arr, Syntax a) => ((Data Index -> a -> M ()) -> Data Index -> (a, a) -> M ()) -> arr (a, a) -> PushVector a Source
zipUnpair :: Syntax a => Vector a -> Vector a -> PushVector a Source
Interleaves the elements of two vectors.
An overloaded function for reordering elements of a vector.
reverse :: (Ixmap arr, Len arr, Syntax a) => arr a -> arr a Source
Reverse a vector. Works for both push and pull vectors.
halve :: Syntax a => Vector a -> (Vector a, Vector a) Source
Split a pull vector in half.
If the input vector has an odd length the second result vector will be one element longer than the first.
riffle :: Syntax a => Vector a -> PushVector a Source
Split a vector in half and interleave the two two halves.
A class for overloading length
for both pull and push vectors
:: (Pushy arr1, Pushy arr2, Syntax b) | |
=> Data Length | Size of the chunks |
-> (Vector a -> arr1 b) | Applied to every chunk |
-> (Vector a -> arr2 b) | Applied to the rest of the vector |
-> Vector a | |
-> PushVector b |
This function can distribute array computations on chunks of a large
pull vector. A call `chunk l f g v` will split the vector v
into chunks
of size l
and apply f
to these chunks. In case the length of v
is
not a multiple of l
then the rest of v
will be processed by g
.
scanl :: (Syntax a, Syntax b) => (a -> b -> a) -> a -> Vector b -> PushVector a Source
scanl
is similar to fold
, but returns a PushVector
of successive
reduced values from the left.
empty :: PushVector a Source
The empty push vector.
flatten :: Syntax a => Vector (PushVector a) -> PushVector a Source
Flattens a pull vector containing push vectors into an unnested push vector
Note that there are no restrictions on the lengths of the push vectors inside the pull vector.