Copyright | Copyright (c) 2007--2015 wren gayle romano |
---|---|
License | BSD3 |
Maintainer | wren@community.haskell.org |
Stability | stable |
Portability | semi-portable (OverlappingInstances,...) |
Safe Haskell | None |
Language | Haskell98 |
- class PartialOrd a where
- comparingPO :: PartialOrd b => (a -> b) -> a -> a -> Maybe Ordering
Partial Ordering
class PartialOrd a where Source
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
cmp :: a -> a -> Maybe Ordering Source
like compare
gt :: a -> a -> Maybe Bool infix 4 Source
like (>
)
ge :: a -> a -> Maybe Bool infix 4 Source
like (>=
)
eq :: a -> a -> Maybe Bool infix 4 Source
like (==
)
ne :: a -> a -> Maybe Bool infix 4 Source
like (/=
)
le :: a -> a -> Maybe Bool infix 4 Source
like (<=
)
lt :: a -> a -> Maybe Bool infix 4 Source
like (<
)
maxPO :: a -> a -> Maybe a infix 4 Source
like max
. The default instance returns the left argument
when they're equal.
minPO :: a -> a -> Maybe a infix 4 Source
like min
. The default instance returns the left argument
when they're equal.
Functions
comparingPO :: PartialOrd b => (a -> b) -> a -> a -> Maybe Ordering Source
Like Data.Ord.comparing
. Helpful in conjunction with the
xxxBy
family of functions from Data.List