module Control.Object.Semilattice (Infimum (..), Supremum (..)) where

{- |
> When providing a new instance, you should ensure it satisfies the three laws:
> * Associativity: x /\ (y /\ z) ≡ (x /\ y) /\ z
> * Commutativity: x /\ y ≡ y /\ x
> * Idempotency: x /\ x ≡ x
-}

class Infimum a where
        {-# MINIMAL (/\) #-}
        (/\) :: a -> a -> a

        infimum :: a -> a -> a
        infimum = (/\)

{- |
> When providing a new instance, you should ensure it satisfies the three laws:
> * Associativity: x \/ (y \/ z) ≡ (x \/ y) \/ z
> * Commutativity: x \/ y ≡ y \/ x
> * Idempotency: x \/ x ≡ x
-}

class Supremum a where
        {-# MINIMAL (\/) #-}
        (\/) :: a -> a -> a

        supremum :: a -> a -> a
        supremum = (\/)