Copyright | (c) Erich Gut |
---|---|
License | BSD3 |
Maintainer | zerich.gut@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Data.Ord enriched with some additional elements.
Synopsis
- module Data.Ord
- fcompare :: Ord i => (a -> i) -> a -> a -> Ordering
- wcompare :: (w -> w -> Ordering) -> (a -> w) -> a -> a -> Ordering
- coCompare :: (a -> a -> Ordering) -> a -> a -> Ordering
- compare2 :: (a -> a -> Ordering) -> (b -> b -> Ordering) -> (a, b) -> (a, b) -> Ordering
- sortFst :: Ord a => [(a, b)] -> [(a, b)]
- sortFstBy :: (a -> a -> Ordering) -> [(a, b)] -> [(a, b)]
- sortSnd :: Ord b => [(a, b)] -> [(a, b)]
- sortSndBy :: (b -> b -> Ordering) -> [(a, b)] -> [(a, b)]
- data Closer x
- cmin :: Ord x => [x] -> Closer x
- cmax :: Ord x => [x] -> Closer x
- cspan :: Ord x => [x] -> Span x
- type Span x = (Closer x, Closer x)
- enumSpan :: (Enum i, Ord i) => i -> Closer i -> [i]
- class Eq a => POrd a where
Total
module Data.Ord
fcompare :: Ord i => (a -> i) -> a -> a -> Ordering Source #
comparing according to the mapped values.
wcompare :: (w -> w -> Ordering) -> (a -> w) -> a -> a -> Ordering Source #
comparing according to the given ordering relation on the mapped values.
compare2 :: (a -> a -> Ordering) -> (b -> b -> Ordering) -> (a, b) -> (a, b) -> Ordering Source #
comparing of pairs.
sortFstBy :: (a -> a -> Ordering) -> [(a, b)] -> [(a, b)] Source #
sorting according to the first component.
sortSndBy :: (b -> b -> Ordering) -> [(a, b)] -> [(a, b)] Source #
sorting according to the second component.
the closer of a linear ordered x
.
cspan :: Ord x => [x] -> Span x Source #
(l,u) =
where cspan
xsl
is the minimum and u
the maximum of the items in
xs
.
Example
>>>
cspan "aeb"
(It 'a',It 'e')
>>>
cspan ""
(PosInf,NegInf)
enumSpan :: (Enum i, Ord i) => i -> Closer i -> [i] Source #
enumerates the index, starting by enumSpan
i0 hi0
to h
.