vector-algorithms-0.5.1: Efficient algorithms for vector arrays

PortabilityNon-portable ()
MaintainerDan Doel <>



This module implements American flag sort: an in-place, unstable, bucket sort. Also in contrast to radix sort, the values are inspected in a big endian order, and buckets are sorted via recursive splitting. This, however, makes it sensible for sorting strings in lexicographic order (provided indexing is fast).


sort :: forall e m v. (PrimMonad m, MVector v e, Lexicographic e, Ord e) => v (PrimState m) e -> m ()Source

sortBy :: (PrimMonad m, MVector v e) => Comparison e -> (e -> Int -> Bool) -> Int -> (Int -> e -> Int) -> v (PrimState m) e -> m ()Source