|
Data.Vector.Primitive | Portability | non-portable | Stability | experimental | Maintainer | Roman Leshchinskiy <rl@cse.unsw.edu.au> |
|
|
|
|
|
Description |
Unboxed vectors of primitive types.
|
|
Synopsis |
|
data Vector a | | data MVector m a = MVector !Int !Int !(MutableByteArray m) | | Prim (sizeOf#, alignment#, indexByteArray#, readByteArray#, writeByteArray#, indexOffAddr#, readOffAddr#, writeOffAddr#) | | length :: Prim a => Vector a -> Int | | null :: Prim a => Vector a -> Bool | | empty :: Prim a => Vector a | | singleton :: Prim a => a -> Vector a | | cons :: Prim a => a -> Vector a -> Vector a | | snoc :: Prim a => Vector a -> a -> Vector a | | replicate :: Prim a => Int -> a -> Vector a | | (++) :: Prim a => Vector a -> Vector a -> Vector a | | copy :: Prim a => Vector a -> Vector a | | (!) :: Prim a => Vector a -> Int -> a | | head :: Prim a => Vector a -> a | | last :: Prim a => Vector a -> a | | slice :: Prim a => Vector a -> Int -> Int -> Vector a | | init :: Prim a => Vector a -> Vector a | | tail :: Prim a => Vector a -> Vector a | | take :: Prim a => Int -> Vector a -> Vector a | | drop :: Prim a => Int -> Vector a -> Vector a | | accum :: Prim a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a | | (//) :: Prim a => Vector a -> [(Int, a)] -> Vector a | | backpermute :: Prim a => Vector a -> Vector Int -> Vector a | | reverse :: Prim a => Vector a -> Vector a | | map :: (Prim a, Prim b) => (a -> b) -> Vector a -> Vector b | | concatMap :: (Prim a, Prim b) => (a -> Vector b) -> Vector a -> Vector b | | zipWith :: (Prim a, Prim b, Prim c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c | | zipWith3 :: (Prim a, Prim b, Prim c, Prim d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d | | filter :: Prim a => (a -> Bool) -> Vector a -> Vector a | | takeWhile :: Prim a => (a -> Bool) -> Vector a -> Vector a | | dropWhile :: Prim a => (a -> Bool) -> Vector a -> Vector a | | elem :: (Prim a, Eq a) => a -> Vector a -> Bool | | notElem :: (Prim a, Eq a) => a -> Vector a -> Bool | | find :: Prim a => (a -> Bool) -> Vector a -> Maybe a | | findIndex :: Prim a => (a -> Bool) -> Vector a -> Maybe Int | | foldl :: Prim b => (a -> b -> a) -> a -> Vector b -> a | | foldl1 :: Prim a => (a -> a -> a) -> Vector a -> a | | foldl' :: Prim b => (a -> b -> a) -> a -> Vector b -> a | | foldl1' :: Prim a => (a -> a -> a) -> Vector a -> a | | foldr :: Prim a => (a -> b -> b) -> b -> Vector a -> b | | foldr1 :: Prim a => (a -> a -> a) -> Vector a -> a | | sum :: (Prim a, Num a) => Vector a -> a | | product :: (Prim a, Num a) => Vector a -> a | | maximum :: (Prim a, Ord a) => Vector a -> a | | minimum :: (Prim a, Ord a) => Vector a -> a | | unfoldr :: Prim a => (b -> Maybe (a, b)) -> b -> Vector a | | prescanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a | | prescanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a | | postscanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a | | postscanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a | | scanl :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a | | scanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector a | | scanl1 :: Prim a => (a -> a -> a) -> Vector a -> Vector a | | scanl1' :: Prim a => (a -> a -> a) -> Vector a -> Vector a | | enumFromTo :: (Prim a, Enum a) => a -> a -> Vector a | | enumFromThenTo :: (Prim a, Enum a) => a -> a -> a -> Vector a | | toList :: Prim a => Vector a -> [a] | | fromList :: Prim a => [a] -> Vector a |
|
|
Documentation |
|
|
Unboxed vectors of primitive types
| Instances | |
|
|
|
Mutable unboxed vectors. They live in the ST monad.
| Constructors | | Instances | |
|
|
Prim (sizeOf#, alignment#, indexByteArray#, readByteArray#, writeByteArray#, indexOffAddr#, readOffAddr#, writeOffAddr#) |
|
Length information
|
|
|
|
|
|
Construction
|
|
|
Empty vector
|
|
|
Vector with exaclty one element
|
|
|
Prepend an element
|
|
|
Append an element
|
|
|
Vector of the given length with the given value in each position
|
|
|
Concatenate two vectors
|
|
|
Create a copy of a vector. Useful when dealing with slices.
|
|
Accessing individual elements
|
|
|
Indexing
|
|
|
First element
|
|
|
Last element
|
|
Subvectors
|
|
|
:: Prim a | | => Vector a | | -> Int | starting index
| -> Int | length
| -> Vector a | | Yield a part of the vector without copying it. Safer version of
unsafeSlice.
|
|
|
|
Yield all but the last element without copying.
|
|
|
All but the first element (without copying).
|
|
|
Yield the first n elements without copying.
|
|
|
Yield all but the first n elements without copying.
|
|
Permutations
|
|
|
|
|
|
|
|
|
|
Mapping
|
|
|
Map a function over a vector
|
|
|
|
Zipping and unzipping
|
|
|
Zip two vectors with the given function.
|
|
|
Zip three vectors with the given function.
|
|
Filtering
|
|
|
Drop elements which do not satisfy the predicate
|
|
|
Yield the longest prefix of elements satisfying the predicate.
|
|
|
Drop the longest prefix of elements that satisfy the predicate.
|
|
Searching
|
|
|
Check whether the vector contains an element
|
|
|
Inverse of elem
|
|
|
Yield Just the first element matching the predicate or Nothing if no
such element exists.
|
|
|
Yield Just the index of the first element matching the predicate or
Nothing if no such element exists.
|
|
Folding
|
|
|
Left fold
|
|
|
Lefgt fold on non-empty vectors
|
|
|
Left fold with strict accumulator
|
|
|
Left fold on non-empty vectors with strict accumulator
|
|
|
Right fold
|
|
|
Right fold on non-empty vectors
|
|
Specialised folds
|
|
|
|
|
|
|
|
|
|
Unfolding
|
|
|
|
Scans
|
|
|
Prefix scan
|
|
|
Prefix scan with strict accumulator
|
|
|
Suffix scan
|
|
|
Suffix scan with strict accumulator
|
|
|
Haskell-style scan
|
|
|
Haskell-style scan with strict accumulator
|
|
|
Scan over a non-empty Vector
|
|
|
Scan over a non-empty Vector with a strict accumulator
|
|
Enumeration
|
|
|
|
|
|
Conversion to/from lists
|
|
|
Convert a vector to a list
|
|
|
Convert a list to a vector
|
|
Produced by Haddock version 2.4.2 |