utility-ht-0.0.5.1: Various small helper functions for Lists, Maybes, Tuples, Functions

Data.Ord.HT

Synopsis

comparing :: Ord b => (a -> b) -> a -> a -> OrderingSource

limit :: Ord a => (a, a) -> a -> aSource

limit (lower,upper) x restricts x to the range from lower to upper. Don't expect a sensible result for lower>upper.

limit (lower,upper) x

x

lower

upper

lower>upper

inRange :: Ord a => (a, a) -> a -> BoolSource

limit (lower,upper) x checks whether x is in the range from lower to upper. Don't expect a sensible result for lower>upper.