Data.Vector.Generic.Mutable.Sized.Vector specialized to use
Data.Vector.Storable.Mutable.
Modulevector-sized-1.6.1Haskell2010
Data.Vector.Storable.Mutable.Sized
This module re-exports the functionality in Data.Vector.Generic.Mutable.Sized
specialized to Data.Vector.Storable.Mutable.
Functions returning a vector determine the size from the type context unless
they have a ' suffix in which case they take an explicit Proxy argument.
Functions where the resulting vector size is not known until runtime are not exported.
- 1 type
- 46 values
- Packagevector-sized-1.6.1
- Exports47
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceSized.hs
Accessors
0 declarationsLength information
O(1) Yield the length of the mutable vector as an Int.
O(1) Yield the length of the mutable vector as a Proxy.
O(1) Check whether the mutable vector is empty.
Extracting subvectors
slice O(1) Yield a slice of the mutable vector without copying it with an inferred length argument.
slice' O(1) Yield a slice of the mutable vector without copying it with an explicit length argument.
O(1) Yield all but the last element of a non-empty mutable vector without copying.
O(1) Yield all but the first element of a non-empty mutable vector without copying.
O(1) Yield the first n elements. The resulting vector always contains
this many elements. The length of the resulting vector is inferred from the
type.
O(1) Yield the first n elements. The resulting vector always contains
this many elements. The length of the resulting vector is given explicitly
as a Proxy argument.
O(1) Yield all but the the first n elements. The given vector must
contain at least this many elements. The length of the resulting vector is
inferred from the type.
O(1) Yield all but the the first n elements. The given vector must
contain at least this many elements. The length of the resulting vector is
givel explicitly as a Proxy argument.
O(1) Yield the first n elements, paired with the rest, without copying.
The lengths of the resulting vectors are inferred from the type.
O(1) Yield the first n elements, paired with the rest, without
copying. The length of the first resulting vector is passed explicitly as a
Proxy argument.
Overlaps
O(1) Check if two vectors overlap.
Construction
0 declarationsInitialisation
Create a mutable vector where the length is inferred from the type.
Create a mutable vector where the length is inferred from the type. The memory is not initialized.
Create a mutable vector where the length is inferred from the type and fill it with an initial value.
Create a mutable vector where the length is given explicitly as a Proxy argument and fill it with an initial value.
Create a mutable vector where the length is inferred from the type and fill it with values produced by repeatedly executing the monadic action.
Create a mutable vector where the length is given explicitly as a Proxy argument and fill it with values produced by repeatedly executing the monadic action.
Create a copy of a mutable vector.
Growing
Grow a mutable vector by an amount given explicitly as a Proxy argument.
Grow a mutable vector (from the front) by an amount given explicitly as a Proxy argument.
Restricting memory usage
Reset all elements of the vector to some undefined value, clearing all references to external objects.
Accessing individual elements
14 declarationsO(1) Yield the element at a given type-safe position using Finite.
O(1) Yield the element at a given type-safe position using Proxy.
O(1) Replace the element at a given type-safe position using Finite.
O(1) Replace the element at a given type-safe position using Proxy.
O(1) Modify the element at a given type-safe position using Finite.
O(1) Modify the element at a given type-safe position using Proxy.
O(1) Swap the elements at the given type-safe positions using Finites.
O(1) Replace the element at a given type-safe position and return the old element, using Finite.
O(1) Replace the element at a given type-safe position and return the old element, using Finite.
O(1) Yield the element at a given Int position without bounds checking.
O(1) Replace the element at a given Int position without bounds checking.
O(1) Modify the element at a given Int position without bounds checking.
O(1) Swap the elements at the given Int positions without bounds checking.
O(1) Replace the element at a given Int position and return the old element. No bounds checks are performed.
Modifying vectors
1 declarationCompute the next permutation (lexicographically) of a given vector in-place. Returns False when the input is the last permutation.
Filling and copying
Set all elements of the vector to the given value.
copy Copy a vector. The two vectors may not overlap.
move Move the contents of a vector. If the two vectors do not overlap, this is equivalent to copy. Otherwise, the copying is performed as if the source vector were copied to a temporary vector and then the temporary vector was copied to the target vector.
unsafeCopy Copy a vector. The two vectors may not overlap. This is not checked.
Conversions
0 declarationsUnsized Mutable Vectors
Takes a MVector and returns
a continuation providing a MVector
with a size parameter n that is determined at runtime based on the
length of the input vector.
Essentially converts a MVector into
a MVector with the correct size parameter
n.
Note that this does no copying; the returned MVector is a reference to the exact same vector in memory as the given one, and any modifications to it are also reflected in the given MVector.