module Pandora.Paradigm.Primary.Object.Denumerator where

import Pandora.Pattern.Category (($))
import Pandora.Pattern.Object.Setoid (Setoid ((==)))
import Pandora.Pattern.Object.Chain (Chain ((<=>)))
import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))
import Pandora.Pattern.Object.Ringoid (Ringoid ((*)))
import Pandora.Paradigm.Primary.Object.Boolean (Boolean (True, False))
import Pandora.Paradigm.Primary.Object.Ordering (Ordering (Less, Equal, Greater))

data Denumerator = One | Denumerator Denumerator

instance Setoid Denumerator where
	Denumerator
One == :: Denumerator -> Denumerator -> Boolean
== Denumerator
One = Boolean
True
	Denumerator Denumerator
n == Denumerator Denumerator
m = Denumerator
n Denumerator -> Denumerator -> Boolean
forall a. Setoid a => a -> a -> Boolean
== Denumerator
m
	Denumerator
_ == Denumerator
_ = Boolean
False

instance Chain Denumerator where
	Denumerator
One <=> :: Denumerator -> Denumerator -> Ordering
<=> Denumerator
One = Ordering
Equal
	Denumerator
One <=> Denumerator Denumerator
_ = Ordering
Less
	Denumerator Denumerator
_ <=> Denumerator
One = Ordering
Greater
	Denumerator Denumerator
n <=> Denumerator Denumerator
m = Denumerator
n Denumerator -> Denumerator -> Ordering
forall a. Chain a => a -> a -> Ordering
<=> Denumerator
m

instance Semigroup Denumerator where
	Denumerator
One + :: Denumerator -> Denumerator -> Denumerator
+ Denumerator
m = Denumerator -> Denumerator
Denumerator Denumerator
m
	Denumerator Denumerator
n + Denumerator
m = Denumerator -> Denumerator
Denumerator (Denumerator -> Denumerator) -> Denumerator -> Denumerator
forall (m :: * -> * -> *) a b. Category m => m a b -> m a b
$ Denumerator
n Denumerator -> Denumerator -> Denumerator
forall a. Semigroup a => a -> a -> a
+ Denumerator
m

instance Ringoid Denumerator where
	Denumerator
One * :: Denumerator -> Denumerator -> Denumerator
* Denumerator
n = Denumerator
n
	Denumerator Denumerator
n * Denumerator
m = Denumerator
m Denumerator -> Denumerator -> Denumerator
forall a. Semigroup a => a -> a -> a
+ Denumerator
n Denumerator -> Denumerator -> Denumerator
forall a. Ringoid a => a -> a -> a
* Denumerator
m