Portability | non-portable |
---|---|

Stability | experimental |

Maintainer | Roman Leshchinskiy <rl@cse.unsw.edu.au> |

Unboxed vectors of primitive types.

- data Vector a
- data MVector s a = MVector !Int !Int !(MutableByteArray s)
- class Prim a
- 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
- generate :: Prim a => Int -> (Int -> a) -> Vector a
- (++) :: Prim a => Vector a -> Vector a -> Vector a
- force :: Prim a => Vector a -> Vector a
- (!) :: Prim a => Vector a -> Int -> a
- head :: Prim a => Vector a -> a
- last :: Prim a => Vector a -> a
- indexM :: (Prim a, Monad m) => Vector a -> Int -> m a
- headM :: (Prim a, Monad m) => Vector a -> m a
- lastM :: (Prim a, Monad m) => Vector a -> m a
- unsafeIndex :: Prim a => Vector a -> Int -> a
- unsafeHead :: Prim a => Vector a -> a
- unsafeLast :: Prim a => Vector a -> a
- unsafeIndexM :: (Prim a, Monad m) => Vector a -> Int -> m a
- unsafeHeadM :: (Prim a, Monad m) => Vector a -> m a
- unsafeLastM :: (Prim a, Monad m) => Vector a -> m a
- slice :: Prim a => Int -> Int -> Vector a -> 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
- unsafeSlice :: Prim a => Int -> Int -> Vector a -> Vector a
- unsafeInit :: Prim a => Vector a -> Vector a
- unsafeTail :: Prim a => Vector a -> Vector a
- unsafeTake :: Prim a => Int -> Vector a -> Vector a
- unsafeDrop :: Prim a => Int -> Vector a -> Vector a
- accum :: Prim a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a
- accumulate_ :: (Prim a, Prim b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a
- (//) :: Prim a => Vector a -> [(Int, a)] -> Vector a
- update_ :: Prim a => Vector a -> Vector Int -> Vector a -> Vector a
- backpermute :: Prim a => Vector a -> Vector Int -> Vector a
- reverse :: Prim a => Vector a -> Vector a
- unsafeAccum :: Prim a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a
- unsafeAccumulate_ :: (Prim a, Prim b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a
- unsafeUpd :: Prim a => Vector a -> [(Int, a)] -> Vector a
- unsafeUpdate_ :: Prim a => Vector a -> Vector Int -> Vector a -> Vector a
- unsafeBackpermute :: Prim a => Vector a -> Vector Int -> Vector a
- map :: (Prim a, Prim b) => (a -> b) -> Vector a -> Vector b
- imap :: (Prim a, Prim b) => (Int -> 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
- zipWith4 :: (Prim a, Prim b, Prim c, Prim d, Prim e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
- zipWith5 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
- zipWith6 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f, Prim g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g
- izipWith :: (Prim a, Prim b, Prim c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c
- izipWith3 :: (Prim a, Prim b, Prim c, Prim d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
- izipWith4 :: (Prim a, Prim b, Prim c, Prim d, Prim e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
- izipWith5 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
- izipWith6 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f, Prim g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g
- filter :: Prim a => (a -> Bool) -> Vector a -> Vector a
- ifilter :: Prim a => (Int -> a -> Bool) -> Vector a -> Vector a
- takeWhile :: Prim a => (a -> Bool) -> Vector a -> Vector a
- dropWhile :: Prim a => (a -> Bool) -> Vector a -> Vector a
- partition :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)
- unstablePartition :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)
- span :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)
- break :: Prim a => (a -> Bool) -> Vector a -> (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
- findIndices :: Prim a => (a -> Bool) -> Vector a -> Vector Int
- elemIndex :: (Prim a, Eq a) => a -> Vector a -> Maybe Int
- elemIndices :: (Prim a, Eq a) => a -> Vector a -> Vector 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
- foldr' :: Prim a => (a -> b -> b) -> b -> Vector a -> b
- foldr1' :: Prim a => (a -> a -> a) -> Vector a -> a
- ifoldl :: Prim b => (a -> Int -> b -> a) -> a -> Vector b -> a
- ifoldl' :: Prim b => (a -> Int -> b -> a) -> a -> Vector b -> a
- ifoldr :: Prim a => (Int -> a -> b -> b) -> b -> Vector a -> b
- ifoldr' :: Prim a => (Int -> a -> b -> b) -> b -> Vector a -> b
- all :: Prim a => (a -> Bool) -> Vector a -> Bool
- any :: Prim a => (a -> Bool) -> Vector a -> Bool
- sum :: (Prim a, Num a) => Vector a -> a
- product :: (Prim a, Num a) => Vector a -> a
- maximum :: (Prim a, Ord a) => Vector a -> a
- maximumBy :: Prim a => (a -> a -> Ordering) -> Vector a -> a
- minimum :: (Prim a, Ord a) => Vector a -> a
- minimumBy :: Prim a => (a -> a -> Ordering) -> Vector a -> a
- minIndex :: (Prim a, Ord a) => Vector a -> Int
- minIndexBy :: Prim a => (a -> a -> Ordering) -> Vector a -> Int
- maxIndex :: (Prim a, Ord a) => Vector a -> Int
- maxIndexBy :: Prim a => (a -> a -> Ordering) -> Vector a -> Int
- unfoldr :: Prim a => (b -> Maybe (a, b)) -> b -> Vector a
- unfoldrN :: Prim a => Int -> (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
- prescanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b
- prescanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b
- postscanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b
- postscanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b
- scanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b
- scanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector b
- scanr1 :: Prim a => (a -> a -> a) -> Vector a -> Vector a
- scanr1' :: Prim a => (a -> a -> a) -> Vector a -> Vector a
- enumFromN :: (Prim a, Num a) => a -> Int -> Vector a
- enumFromStepN :: (Prim a, Num a) => a -> a -> Int -> 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
- fromListN :: Prim a => Int -> [a] -> Vector a
- replicateM :: (Monad m, Prim a) => Int -> m a -> m (Vector a)
- mapM :: (Monad m, Prim a, Prim b) => (a -> m b) -> Vector a -> m (Vector b)
- mapM_ :: (Monad m, Prim a) => (a -> m b) -> Vector a -> m ()
- forM :: (Monad m, Prim a, Prim b) => Vector a -> (a -> m b) -> m (Vector b)
- forM_ :: (Monad m, Prim a) => Vector a -> (a -> m b) -> m ()
- zipWithM :: (Monad m, Prim a, Prim b, Prim c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)
- zipWithM_ :: (Monad m, Prim a, Prim b) => (a -> b -> m c) -> Vector a -> Vector b -> m ()
- filterM :: (Monad m, Prim a) => (a -> m Bool) -> Vector a -> m (Vector a)
- foldM :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m a
- foldM' :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m a
- fold1M :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m a
- fold1M' :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m a
- create :: Prim a => (forall s. ST s (MVector s a)) -> Vector a
- modify :: Prim a => (forall s. MVector s a -> ST s ()) -> Vector a -> Vector a
- copy :: (Prim a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()
- unsafeCopy :: (Prim a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()

# Documentation

Unboxed vectors of primitive types

Mutable vectors of primitive types.

MVector !Int !Int !(MutableByteArray s) |

class Prim a

Class of types supporting primitive array operations

# Length information

# Construction

replicate :: Prim a => Int -> a -> Vector aSource

Vector of the given length with the given value in each position

generate :: Prim a => Int -> (Int -> a) -> Vector aSource

Generate a vector of the given length by applying the function to each index

force :: Prim a => Vector a -> Vector aSource

Create a copy of a vector. Useful when dealing with slices.

# Accessing individual elements

indexM :: (Prim a, Monad m) => Vector a -> Int -> m aSource

Monadic indexing which can be strict in the vector while remaining lazy in the element

unsafeIndex :: Prim a => Vector a -> Int -> aSource

Unsafe indexing without bounds checking

unsafeHead :: Prim a => Vector a -> aSource

Yield the first element of a vector without checking if the vector is empty

unsafeLast :: Prim a => Vector a -> aSource

Yield the last element of a vector without checking if the vector is empty

unsafeIndexM :: (Prim a, Monad m) => Vector a -> Int -> m aSource

Unsafe monadic indexing without bounds checks

unsafeHeadM :: (Prim a, Monad m) => Vector a -> m aSource

unsafeLastM :: (Prim a, Monad m) => Vector a -> m aSource

# Subvectors

Yield a part of the vector without copying it. Safer version of
`basicUnsafeSlice`

.

drop :: Prim a => Int -> Vector a -> Vector aSource

Yield all but the first `n`

elements without copying.

Unsafely yield a part of the vector without copying it and without performing bounds checks.

unsafeInit :: Prim a => Vector a -> Vector aSource

unsafeTail :: Prim a => Vector a -> Vector aSource

# Permutations

accumulate_ :: (Prim a, Prim b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector aSource

unsafeAccumulate_ :: (Prim a, Prim b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector aSource

# Mapping

imap :: (Prim a, Prim b) => (Int -> a -> b) -> Vector a -> Vector bSource

Apply a function to every index/value pair

# Zipping and unzipping

zipWith :: (Prim a, Prim b, Prim c) => (a -> b -> c) -> Vector a -> Vector b -> Vector cSource

Zip two vectors with the given function.

zipWith3 :: (Prim a, Prim b, Prim c, Prim d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector dSource

Zip three vectors with the given function.

zipWith4 :: (Prim a, Prim b, Prim c, Prim d, Prim e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector eSource

zipWith5 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector fSource

zipWith6 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f, Prim g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector gSource

izipWith :: (Prim a, Prim b, Prim c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector cSource

Zip two vectors and their indices with the given function.

izipWith3 :: (Prim a, Prim b, Prim c, Prim d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector dSource

Zip three vectors and their indices with the given function.

izipWith4 :: (Prim a, Prim b, Prim c, Prim d, Prim e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector eSource

izipWith5 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector fSource

izipWith6 :: (Prim a, Prim b, Prim c, Prim d, Prim e, Prim f, Prim g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector gSource

# Filtering

filter :: Prim a => (a -> Bool) -> Vector a -> Vector aSource

Drop elements which do not satisfy the predicate

ifilter :: Prim a => (Int -> a -> Bool) -> Vector a -> Vector aSource

Drop elements that do not satisfy the predicate (applied to values and their indices)

takeWhile :: Prim a => (a -> Bool) -> Vector a -> Vector aSource

Yield the longest prefix of elements satisfying the predicate.

dropWhile :: Prim a => (a -> Bool) -> Vector a -> Vector aSource

Drop the longest prefix of elements that satisfy the predicate.

partition :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)Source

Split the vector in two parts, the first one containing those elements
that satisfy the predicate and the second one those that don't. The
relative order of the elements is preserved at the cost of a (sometimes)
reduced performance compared to `unstablePartition`

.

unstablePartition :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)Source

Split the vector in two parts, the first one containing those elements that satisfy the predicate and the second one those that don't. The order of the elements is not preserved.

span :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)Source

Split the vector into the longest prefix of elements that satisfy the predicate and the rest.

break :: Prim a => (a -> Bool) -> Vector a -> (Vector a, Vector a)Source

Split the vector into the longest prefix of elements that do not satisfy the predicate and the rest.

# Searching

findIndices :: Prim a => (a -> Bool) -> Vector a -> Vector IntSource

Yield the indices of elements satisfying the predicate

elemIndices :: (Prim a, Eq a) => a -> Vector a -> Vector IntSource

Yield the indices of all occurences of the given element

# Folding

foldl1' :: Prim a => (a -> a -> a) -> Vector a -> aSource

Left fold on non-empty vectors with strict accumulator

foldr1' :: Prim a => (a -> a -> a) -> Vector a -> aSource

Right fold on non-empty vectors with strict accumulator

ifoldl :: Prim b => (a -> Int -> b -> a) -> a -> Vector b -> aSource

Left fold (function applied to each element and its index)

ifoldl' :: Prim b => (a -> Int -> b -> a) -> a -> Vector b -> aSource

Left fold with strict accumulator (function applied to each element and its index)

ifoldr :: Prim a => (Int -> a -> b -> b) -> b -> Vector a -> bSource

Right fold (function applied to each element and its index)

ifoldr' :: Prim a => (Int -> a -> b -> b) -> b -> Vector a -> bSource

Right fold with strict accumulator (function applied to each element and its index)

# Specialised folds

# Unfolding

unfoldr :: Prim a => (b -> Maybe (a, b)) -> b -> Vector aSource

The `unfoldr`

function is a `dual' to `foldr`

: while `foldr`

reduces a vector to a summary value, `unfoldr`

builds a list from
a seed value. The function takes the element and returns `Nothing`

if it is done generating the vector or returns `Just`

`(a,b)`

, in which
case, `a`

is a prepended to the vector and `b`

is used as the next
element in a recursive call.

A simple use of unfoldr:

unfoldr (\b -> if b == 0 then Nothing else Just (b, b-1)) 10 [10,9,8,7,6,5,4,3,2,1]

# Scans

prescanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector aSource

Prefix scan with strict accumulator

postscanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector aSource

Suffix scan with strict accumulator

scanl' :: (Prim a, Prim b) => (a -> b -> a) -> a -> Vector b -> Vector aSource

Haskell-style scan with strict accumulator

scanl1' :: Prim a => (a -> a -> a) -> Vector a -> Vector aSource

Scan over a non-empty `Vector`

with a strict accumulator

prescanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector bSource

Prefix right-to-left scan

prescanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector bSource

Prefix right-to-left scan with strict accumulator

postscanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector bSource

Suffix right-to-left scan

postscanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector bSource

Suffix right-to-left scan with strict accumulator

scanr :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector bSource

Haskell-style right-to-left scan

scanr' :: (Prim a, Prim b) => (a -> b -> b) -> b -> Vector a -> Vector bSource

Haskell-style right-to-left scan with strict accumulator

scanr1 :: Prim a => (a -> a -> a) -> Vector a -> Vector aSource

Right-to-left scan over a non-empty vector

scanr1' :: Prim a => (a -> a -> a) -> Vector a -> Vector aSource

Right-to-left scan over a non-empty vector with a strict accumulator

# Enumeration

enumFromN :: (Prim a, Num a) => a -> Int -> Vector aSource

Yield a vector of the given length containing the values `x`

, `x+1`

etc.
This operation is usually more efficient than `enumFromTo`

.

enumFromStepN :: (Prim a, Num a) => a -> a -> Int -> Vector aSource

Yield a vector of the given length containing the values `x`

, `x+y`

,
`x+y+y`

etc. This operations is usually more efficient than
`enumFromThenTo`

.

enumFromTo :: (Prim a, Enum a) => a -> a -> Vector aSource

Enumerate values from `x`

to `y`

.

*WARNING:* This operation can be very inefficient. If at all possible, use
`enumFromN`

instead.

enumFromThenTo :: (Prim a, Enum a) => a -> a -> a -> Vector aSource

Enumerate values from `x`

to `y`

with a specific step `z`

.

*WARNING:* This operation can be very inefficient. If at all possible, use
`enumFromStepN`

instead.

# Conversion to/from lists

fromListN :: Prim a => Int -> [a] -> Vector aSource

Convert the first `n`

elements of a list to a vector

fromListN n xs = fromList (take n xs)

# Monadic operations

replicateM :: (Monad m, Prim a) => Int -> m a -> m (Vector a)Source

Perform the monadic action the given number of times and store the results in a vector.

mapM :: (Monad m, Prim a, Prim b) => (a -> m b) -> Vector a -> m (Vector b)Source

Apply the monadic action to all elements of the vector, yielding a vector of results

mapM_ :: (Monad m, Prim a) => (a -> m b) -> Vector a -> m ()Source

Apply the monadic action to all elements of a vector and ignore the results

forM :: (Monad m, Prim a, Prim b) => Vector a -> (a -> m b) -> m (Vector b)Source

Apply the monadic action to all elements of the vector, yielding a vector of results

forM_ :: (Monad m, Prim a) => Vector a -> (a -> m b) -> m ()Source

Apply the monadic action to all elements of a vector and ignore the results

zipWithM :: (Monad m, Prim a, Prim b, Prim c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)Source

Zip the two vectors with the monadic action and yield a vector of results

zipWithM_ :: (Monad m, Prim a, Prim b) => (a -> b -> m c) -> Vector a -> Vector b -> m ()Source

Zip the two vectors with the monadic action and ignore the results

filterM :: (Monad m, Prim a) => (a -> m Bool) -> Vector a -> m (Vector a)Source

Drop elements that do not satisfy the monadic predicate

foldM' :: (Monad m, Prim b) => (a -> b -> m a) -> a -> Vector b -> m aSource

Monadic fold with strict accumulator

fold1M :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m aSource

Monadic fold over non-empty vectors

fold1M' :: (Monad m, Prim a) => (a -> a -> m a) -> Vector a -> m aSource

Monad fold over non-empty vectors with strict accumulator

# Destructive operations

create :: Prim a => (forall s. ST s (MVector s a)) -> Vector aSource

Destructively initialise a vector.

modify :: Prim a => (forall s. MVector s a -> ST s ()) -> Vector a -> Vector aSource

Apply a destructive operation to a vector. The operation is applied to a copy of the vector unless it can be safely performed in place.