HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

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
typetype MVector = MVector MVector
#

Data.Vector.Generic.Mutable.Sized.Vector specialized to use Data.Vector.Storable.Mutable.

Accessors

0 declarations

Length information

Extracting subvectors

valueinit :: Storable a => MVector (n + 1) s a -> MVector n s a
#

O(1) Yield all but the last element of a non-empty mutable vector without copying.

valuetail :: Storable a => MVector (1 + n) s a -> MVector n s a
#

O(1) Yield all but the first element of a non-empty mutable vector without copying.

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.

valuesplitAt
  1. :: (KnownNat n, Storable a)
  2. => MVector (n + m) s a
  3. -> (MVector n s a, MVector m s a)
#

O(1) Yield the first n elements, paired with the rest, without copying. The lengths of the resulting vectors are inferred from the type.

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

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

Construction

0 declarations

Initialisation

Growing

Restricting memory usage

Accessing individual elements

14 declarations

Modifying vectors

1 declaration

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

0 declarations

Unsized Mutable Vectors

valuetoSized :: (KnownNat n, Storable a) => MVector s a -> Maybe (MVector n s a)
#

Convert a MVector into a MVector if it has the correct size, otherwise return Nothing.

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.

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.

valuefromSized :: MVector n s a -> MVector s a
#

Convert a MVector into a MVector.

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.