HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

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.

Contents
  1. Accessors
  2. Length information
  3. Extracting subvectors
  4. Overlaps
  5. Construction
  6. Initialisation
  7. Growing
  8. Restricting memory usage
  9. Accessing individual elements
  10. Modifying vectors
  11. Filling and copying
  12. Conversions
  13. Unsized Mutable Vectors
Synopsis

Accessors

Length information

Extracting subvectors

valuetake :: (KnownNat n, Storable a) => MVector (n + k) s a -> MVector n s a

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.

valuetake'
  1. :: (KnownNat n, Storable a)
  2. => p n
  3. -> MVector (n + k) s a
  4. -> MVector n s a

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.

valuedrop :: (KnownNat n, Storable a) => MVector (n + k) s a -> MVector k s a

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.

valuedrop'
  1. :: (KnownNat n, Storable a)
  2. => p n
  3. -> MVector (n + k) s a
  4. -> MVector k s a

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.

Overlaps

Construction

Initialisation

Growing

Restricting memory usage

Accessing individual elements

Modifying vectors

Filling and copying

valuemove
  1. :: (PrimMonad m, Storable a)
  2. => MVector n (PrimState m) a

    target

  3. -> MVector n (PrimState m) a

    source

  4. -> m ()

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.

Conversions

Unsized Mutable Vectors

valuewithSized
  1. :: Storable a
  2. => MVector s a
  3. -> forall (n :: Nat). KnownNat n => MVector n s a -> r
  4. -> r

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.