License | BSD-style (see the LICENSE file in the distribution) |
---|---|
Maintainer | libraries@haskell.org |
Stability | experimental |
Portability | not portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Basic operations on type-level Orderings.
Since: base-4.16.0.0
Synopsis
- type family Compare (a :: k) (b :: k) :: Ordering
- data OrderingI a b where
- type (<=) x y = (x <=? y) ~ 'True
- type (<=?) m n = OrdCond (Compare m n) 'True 'True 'False
- type (>=) x y = (x >=? y) ~ 'True
- type (>=?) m n = OrdCond (Compare m n) 'False 'True 'True
- type (>) x y = (x >? y) ~ 'True
- type (>?) m n = OrdCond (Compare m n) 'False 'False 'True
- type (<) x y = (x <? y) ~ 'True
- type (<?) m n = OrdCond (Compare m n) 'True 'False 'False
- type Max m n = OrdCond (Compare m n) n n m
- type Min m n = OrdCond (Compare m n) m m n
- type family OrdCond o lt eq gt where ...
Documentation
type family Compare (a :: k) (b :: k) :: Ordering Source #
Compare
branches on the kind of its arguments to either compare by
Symbol
or Nat
.
Since: base-4.16.0.0
Instances
type Compare (a :: Natural) (b :: Natural) # | |
Defined in Data.Type.Ord | |
type Compare (a :: Char) (b :: Char) # | |
Defined in Data.Type.Ord | |
type Compare (a :: Symbol) (b :: Symbol) # | |
Defined in Data.Type.Ord |
data OrderingI a b where Source #
Ordering data type for type literals that provides proof of their ordering.
Since: base-4.16.0.0
LTI :: Compare a b ~ 'LT => OrderingI a b | |
EQI :: Compare a a ~ 'EQ => OrderingI a a | |
GTI :: Compare a b ~ 'GT => OrderingI a b |
type (<=) x y = (x <=? y) ~ 'True infix 4 Source #
Comparison (<=) of comparable types, as a constraint.
Since: base-4.16.0.0
type (<=?) m n = OrdCond (Compare m n) 'True 'True 'False infix 4 Source #
Comparison (<=) of comparable types, as a function.
Since: base-4.16.0.0
type (>=) x y = (x >=? y) ~ 'True infix 4 Source #
Comparison (>=) of comparable types, as a constraint.
Since: base-4.16.0.0
type (>=?) m n = OrdCond (Compare m n) 'False 'True 'True infix 4 Source #
Comparison (>=) of comparable types, as a function.
Since: base-4.16.0.0
type (>) x y = (x >? y) ~ 'True infix 4 Source #
Comparison (>) of comparable types, as a constraint.
Since: base-4.16.0.0
type (>?) m n = OrdCond (Compare m n) 'False 'False 'True infix 4 Source #
Comparison (>) of comparable types, as a function.
Since: base-4.16.0.0
type (<) x y = (x <? y) ~ 'True infix 4 Source #
Comparison (<) of comparable types, as a constraint.
Since: base-4.16.0.0
type (<?) m n = OrdCond (Compare m n) 'True 'False 'False infix 4 Source #
Comparison (<) of comparable types, as a function.
Since: base-4.16.0.0
type Max m n = OrdCond (Compare m n) n n m Source #
Maximum between two comparable types.
Since: base-4.16.0.0