toy-lib-0.1.0.0
Safe HaskellSafe-Inferred
LanguageHaskell2010

ToyLib.Compat

Description

Compatibilities.

Synopsis

Documentation

next permutation

nextPermutation :: (PrimMonad m, Ord e, MVector v e) => v (PrimState m) e -> m Bool #

Compute the (lexicographically) next permutation of the given vector in-place. Returns False when the input is the last permutation; in this case the vector will not get updated, as opposed to the behavior of the C++ function std::next_permutation.

nextPermutationBy :: (PrimMonad m, MVector v e) => (e -> e -> Ordering) -> v (PrimState m) e -> m Bool #

Compute the (lexicographically) next permutation of the given vector in-place, using the provided comparison function. Returns False when the input is the last permutation; in this case the vector will not get updated, as opposed to the behavior of the C++ function std::next_permutation.

prevPermutation :: (PrimMonad m, Ord e, MVector v e) => v (PrimState m) e -> m Bool #

Compute the (lexicographically) previous permutation of the given vector in-place. Returns False when the input is the last permutation; in this case the vector will not get updated, as opposed to the behavior of the C++ function std::next_permutation.

prevPermutationBy :: (PrimMonad m, MVector v e) => (e -> e -> Ordering) -> v (PrimState m) e -> m Bool #

Compute the (lexicographically) previous permutation of the given vector in-place, using the provided comparison function. Returns False when the input is the last permutation; in this case the vector will not get updated, as opposed to the behavior of the C++ function std::next_permutation.

nextPermutationByLt :: (PrimMonad m, MVector v e) => (e -> e -> Bool) -> v (PrimState m) e -> m Bool #