Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Equality and ordering.
Note that equality doesn't really require a class,
it can be defined uniformly as TyEq
.
Order
data Compare :: a -> a -> Exp Ordering Source #
Type-level compare
for totally ordered data types.
Example
>>>
:kind! Eval (Compare "a" "b")
Eval (Compare "a" "b") :: Ordering = 'LT
>>>
:kind! Eval (Compare '[1, 2, 3] '[1, 2, 3])
Eval (Compare '[1, 2, 3] '[1, 2, 3]) :: Ordering = 'EQ
>>>
:kind! Eval (Compare '[1, 3] '[1, 2])
Eval (Compare '[1, 3] '[1, 2]) :: Ordering = 'GT
Instances
data (<=) :: a -> a -> Exp Bool Source #
"Smaller than or equal to". Type-level version of (
.<=
)
Example
>>>
:kind! Eval ("b" <= "a")
Eval ("b" <= "a") :: Bool = 'False
data (>=) :: a -> a -> Exp Bool Source #
"Greater than or equal to". Type-level version of (
.>=
)
Example
>>>
:kind! Eval ("b" >= "a")
Eval ("b" >= "a") :: Bool = 'True
data (<) :: a -> a -> Exp Bool Source #
"Smaller than". Type-level version of (
.<
)
Example
>>>
:kind! Eval ("a" < "b")
Eval ("a" < "b") :: Bool = 'True
data (>) :: a -> a -> Exp Bool Source #
"Greater than". Type-level version of (
.>
)
Example
>>>
:kind! Eval ("b" > "a")
Eval ("b" > "a") :: Bool = 'True