module Pandora.Pattern.Object.Chain (Chain (..)) where
import Pandora.Pattern.Object.Setoid (Setoid)
import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False))
import Pandora.Paradigm.Primary.Object.Ordering (Ordering, order)
infixl 4 <=>, <, <=, >=, >
class Setoid a => Chain a where
{-# MINIMAL (<=>) #-}
(<=>) :: a -> a -> Ordering
(<) :: a -> a -> Boolean
a
x < a
y = Boolean -> Boolean -> Boolean -> Ordering -> Boolean
forall a. a -> a -> a -> Ordering -> a
order Boolean
False Boolean
True Boolean
False (a
x a -> a -> Ordering
forall a. Chain a => a -> a -> Ordering
<=> a
y)
(<=) :: a -> a -> Boolean
a
x <= a
y = Boolean -> Boolean -> Boolean -> Ordering -> Boolean
forall a. a -> a -> a -> Ordering -> a
order Boolean
True Boolean
True Boolean
False (a
x a -> a -> Ordering
forall a. Chain a => a -> a -> Ordering
<=> a
y)
(>) :: a -> a -> Boolean
a
x > a
y = Boolean -> Boolean -> Boolean -> Ordering -> Boolean
forall a. a -> a -> a -> Ordering -> a
order Boolean
False Boolean
False Boolean
True (a
x a -> a -> Ordering
forall a. Chain a => a -> a -> Ordering
<=> a
y)
(>=) :: a -> a -> Boolean
a
x >= a
y = Boolean -> Boolean -> Boolean -> Ordering -> Boolean
forall a. a -> a -> a -> Ordering -> a
order Boolean
True Boolean
False Boolean
True (a
x a -> a -> Ordering
forall a. Chain a => a -> a -> Ordering
<=> a
y)