sorting-network-0.2.1.0: Sort small lists with sorting network.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.SortingNetwork.MutableVector

Description

Functions that sorts mutable vectors using sorting network.

Synopsis

Documentation

unsafeSortBy :: (PrimMonad m, MVector v e) => MkPairs -> (e -> e -> Ordering) -> v (PrimState m) e -> m () Source #

Sorts a mutable vector by applying compare-and-swap operations generated through MkPairs.

Raises error if vector size cannot be handled by the sorting network.

maySortBy :: (PrimMonad m, MVector v e) => MkPairs -> (e -> e -> Ordering) -> v (PrimState m) e -> m (Maybe (v (PrimState m) e)) Source #

Safe version of unsafeSortBy.

This function either returns input vector reference upon successful sorting or Nothing if the vector size cannot be handled.