Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Documentation
class Eq a => Ord a where Source #
Linear Orderings
Linear orderings provide a strict order. The laws for (<=)
for
all \(a,b,c\):
- reflexivity: \(a \leq a \)
- antisymmetry: \((a \leq b) \land (b \leq a) \rightarrow (a = b) \)
- transitivity: \((a \leq b) \land (b \leq c) \rightarrow (a \leq c) \)
and these "agree" with <
:
x <= y
=not (y > x)
x >= y
=not (y < x)
Unlike in the non-linear setting, a linear compare
doesn't follow from
<=
since it requires calls: one to <=
and one to ==
. However,
from a linear compare
it is easy to implement the others. Hence, the
minimal complete definition only contains compare
.
compare :: a %1 -> a %1 -> Ordering Source #
compare x y
returns an Ordering
which is
one of GT
(greater than), EQ
(equal), or LT
(less than)
which should be understood as "x is (compare x y)
y".
(<=) :: a %1 -> a %1 -> Bool infix 4 Source #
(<) :: a %1 -> a %1 -> Bool infix 4 Source #
Instances
Ord Bool Source # | |
Ord Char Source # | |
Ord Double Source # | |
Ord Int Source # | |
Ord Ordering Source # | |
Defined in Data.Ord.Linear.Internal.Ord | |
Ord () Source # | |
(Consumable a, Ord a) => Ord [a] Source # | |
(Consumable a, Ord a) => Ord (Maybe a) Source # | |
Ord a => Ord (Ur a) Source # | |
(Consumable a, Consumable b, Ord a, Ord b) => Ord (Either a b) Source # | |
Defined in Data.Ord.Linear.Internal.Ord | |
(Ord a, Ord b) => Ord (a, b) Source # | |
(Ord a, Ord b, Ord c) => Ord (a, b, c) Source # | |
Defined in Data.Ord.Linear.Internal.Ord | |
(Ord a, Ord b, Ord c, Ord d) => Ord (a, b, c, d) Source # | |
Instances
Bounded Ordering | Since: base-2.1 |
Enum Ordering | Since: base-2.1 |
Eq Ordering | |
Ord Ordering | |
Defined in GHC.Classes | |
Read Ordering | Since: base-2.1 |
Show Ordering | Since: base-2.1 |
Ix Ordering | Since: base-2.1 |
Defined in GHC.Ix | |
Generic Ordering | |
Semigroup Ordering | Since: base-4.9.0.0 |
Monoid Ordering | Since: base-2.1 |
Hashable Ordering | |
Defined in Data.Hashable.Class | |
Consumable Ordering Source # | |
Defined in Data.Unrestricted.Internal.Instances | |
Semigroup Ordering Source # | |
Monoid Ordering Source # | |
Defined in Data.Monoid.Linear.Internal.Monoid | |
Dupable Ordering Source # | |
Movable Ordering Source # | |
Eq Ordering Source # | |
Ord Ordering Source # | |
Defined in Data.Ord.Linear.Internal.Ord | |
type Rep Ordering | Since: base-4.6.0.0 |