HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulenonempty-vector-0.2.3Haskell2010

Data.Vector.NonEmpty.Mutable

Non-empty mutable boxed vectors.

  • 3 types
  • 39 values

Mutable boxed vectors

3 declarations
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

0 declarations

Length information

Extracting subvectors

valueunsafeDrop :: Int -> NonEmptyMVector s a -> MVector s a
#

Yield all but the first n elements without copying. The vector must contain at least n elements but this is not checked.

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

8 declarations

Modifying vectors

1 declaration

Filling and copying

valuemove
  1. :: PrimMonad m
  2. => NonEmptyMVector (PrimState m) a
  3. -> NonEmptyMVector (PrimState m) a
  4. -> m ()
#

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.