| Copyright | Copyright (c) 2007--2015 wren gayle romano |
|---|---|
| License | BSD3 |
| Maintainer | wren@community.haskell.org |
| Stability | stable |
| Portability | semi-portable (OverlappingInstances,...) |
| Safe Haskell | Safe |
| Language | Haskell98 |
Data.Number.PartialOrd
Contents
Description
- class PartialOrd a where
- comparingPO :: PartialOrd b => (a -> b) -> a -> a -> Maybe Ordering
Partial Ordering
class PartialOrd a where #
This class defines a partially ordered type. The method names
were chosen so as not to conflict with Ord and Eq. We use
Maybe instead of defining new types PartialOrdering and
FuzzyBool because this way should make the class easier to
use.
Minimum complete definition: cmp
Minimal complete definition
Methods
cmp :: a -> a -> Maybe Ordering #
like compare
gt :: a -> a -> Maybe Bool infix 4 #
like (>)
ge :: a -> a -> Maybe Bool infix 4 #
like (>=)
eq :: a -> a -> Maybe Bool infix 4 #
like (==)
ne :: a -> a -> Maybe Bool infix 4 #
like (/=)
le :: a -> a -> Maybe Bool infix 4 #
like (<=)
lt :: a -> a -> Maybe Bool infix 4 #
like (<)
maxPO :: a -> a -> Maybe a infix 4 #
like max. The default instance returns the left argument
when they're equal.
minPO :: a -> a -> Maybe a infix 4 #
like min. The default instance returns the left argument
when they're equal.
Instances
| PartialOrd Double # | |
| PartialOrd Float # | |
| Ord a => PartialOrd a # | |
| PartialOrd LogFloat # | |
Functions
comparingPO :: PartialOrd b => (a -> b) -> a -> a -> Maybe Ordering #
Like Data.Ord.comparing. Helpful in conjunction with the
xxxBy family of functions from Data.List