hmt-base-0.20: Haskell Music Theory Base
Safe HaskellSafe-Inferred
LanguageHaskell2010

Music.Theory.Ord

Description

Ordering functions

Synopsis

Documentation

min_by :: Ord a => (t -> a) -> t -> t -> t Source #

Minimum by f.

int_to_ord :: Int -> Ordering Source #

Specialised toEnum.

ord_invert :: Ordering -> Ordering Source #

Invert Ordering.

map ord_invert [LT,EQ,GT] == [GT,EQ,LT]

order_pair :: Ordering -> (t, t) -> (t, t) Source #

Given Ordering, re-order pair,

sort_pair :: (t -> t -> Ordering) -> (t, t) -> (t, t) Source #

Sort a pair of equal type values using given comparison function.

sort_pair compare ('b','a') == ('a','b')

sort_pair_m :: (t -> t -> Maybe Ordering) -> (t, t) -> Maybe (t, t) Source #

Variant where the comparison function may not compute a value.