fromList : List a -> Vector a
Build a dense vector from a list.
import Data.VectorfromList : List a -> Vector atoList : Vector a -> List alength : Vector a -> Natlookup : Vector a -> Nat -> Maybe a(!) : Vector a -> Nat -> Maybe aindex : Vector a -> Nat -> aset : Vector a -> Nat -> a -> Vector awithMutable : Vector a -> (forall s. Array s a -> b with Mut s) -> breverse : Vector a -> Vector amap : (a -> b) -> Vector a -> Vector bfilter : (a -> Bool) -> Vector a -> Vector afoldr : (a -> b -> b) -> b -> Vector a -> bfoldl : (b -> a -> b) -> b -> Vector a -> bfoldMap : Monoid m => (a -> m) -> Vector a -> mzipWith : (a -> b -> c) -> Vector a -> Vector b -> Vector celem : Eq a => a -> Vector a -> Booltake : Nat -> Vector a -> Vector adrop : Nat -> Vector a -> Vector aslice : Nat -> Nat -> Vector a -> Vector aappend : Vector a -> Vector a -> Vector aconcat : List (Vector a) -> Vector afromList : List a -> Vector a
Build a dense vector from a list.
toList : Vector a -> List a
The elements of a vector, in order, as a list.
length : Vector a -> Nat
The number of elements. Nat, the same count type as List.length.
lookup : Vector a -> Nat -> Maybe a
(!) : Vector a -> Nat -> Maybe a
Safe subscript vec[i]? — Nothing if i is out of range.
index : Vector a -> Nat -> a
Direct subscript vec[i] — panics if i is out of range.
set : Vector a -> Nat -> a -> Vector a
set vec i v — a NEW vector with position i set to v (unchanged if i is out of range). The notation vec { [i] := v } is equivalent (kept — decision Q3 2026-07-02 — but set is the form to teach and document).
withMutable : Vector a -> (forall s. Array s a -> b with Mut s) -> b
The create-mutate-freeze boundary: run f on a fresh MUTABLE copy of vec, discharging Mut so the result type is pure (residual effects like IO pass through). The classic pattern returns a value built from the mutated array (freeze marr, or its toList).
Vector.withMutable (Vector.fromList xs) sortInPlaceThenFreeze.
reverse : Vector a -> Vector a
Reverse the order of the elements.
map : (a -> b) -> Vector a -> Vector b
Apply f to every element, preserving order and length.
filter : (a -> Bool) -> Vector a -> Vector a
Keep the elements satisfying the predicate, in order.
foldr : (a -> b -> b) -> b -> Vector a -> b
Right fold over the elements.
foldl : (b -> a -> b) -> b -> Vector a -> b
Left fold over the elements.
foldMap : Monoid m => (a -> m) -> Vector a -> m
Map each element to a monoid and combine, in order (mempty if empty).
zipWith : (a -> b -> c) -> Vector a -> Vector b -> Vector c
Combine two vectors element-wise with f, stopping at the shorter.
elem : Eq a => a -> Vector a -> Bool
Is the element present? (Eq on the element type.) Stops at the first element equal to it.
take : Nat -> Vector a -> Vector a
The first n elements (all of them if n exceeds the length).
drop : Nat -> Vector a -> Vector a
All but the first n elements (empty if n exceeds the length).
slice : Nat -> Nat -> Vector a -> Vector a
The len elements starting at index start (clamped to the bounds).
append : Vector a -> Vector a -> Vector a
Append two vectors.
concat : List (Vector a) -> Vector a
Flatten a list of vectors into one, in order.