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

Mutable boxed vectors

newtypenewtype NonEmptyMVector s a

NonEmptyMVector is a thin wrapper around MVector that witnesses an API requiring non-empty construction, initialization, and generation of non-empty vectors by design.

A newtype wrapper was chosen so that no new pointer indirection is introduced when working with MVectors, and all performance characteristics inherited from the MVector API still apply.

Accessors

Length information

Extracting subvectors

Overlapping

Conversions

Convert a mutable vector to a non-empty mutable vector

Warning: this function is unsafe and can result in empty non-empty mutable vectors. If you call this function, the onus is on you to make sure the mutable vector being converted is not empty.

Initialisation

Growing

Restricting memory usage

valueclear :: PrimMonad m => NonEmptyMVector (PrimState m) a -> m ()

Reset all elements of the vector to some undefined value, clearing all references to external objects. This is usually a noop for unboxed vectors.

Accessing individual elements

Modifying vectors

Filling and copying

Move the contents of a vector. The two vectors must have the same length.

If the vectors do not overlap, then 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.

valueunsafeMove
  1. :: PrimMonad m
  2. => NonEmptyMVector (PrimState m) a

    target

  3. -> NonEmptyMVector (PrimState m) a

    source

  4. -> m ()

Move the contents of a vector. The two vectors must have the same length, but this is not checked.

If the vectors do not overlap, then this is equivalent to unsafeCopy. 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.