module Pandora.Paradigm.Primary.Object.Boolean where

import Pandora.Pattern.Object.Semigroup (Semigroup ((+)))
import Pandora.Pattern.Object.Ringoid (Ringoid ((*)))
import Pandora.Pattern.Object.Monoid (Monoid (zero))
import Pandora.Pattern.Object.Quasiring (Quasiring (one))

infixr 1 ?

data Boolean = True | False

bool :: a -> a -> Boolean -> a
bool :: a -> a -> Boolean -> a
bool a
x a
_ Boolean
False = a
x
bool a
_ a
y Boolean
True = a
y

(?) :: Boolean -> a -> a -> a
? :: Boolean -> a -> a -> a
(?) Boolean
True a
x a
_ = a
x
(?) Boolean
False a
_ a
y = a
y

instance Semigroup Boolean where
	Boolean
False + :: Boolean -> Boolean -> Boolean
+ Boolean
False = Boolean
False
	Boolean
_ + Boolean
_ = Boolean
True

instance Ringoid Boolean where
	Boolean
True * :: Boolean -> Boolean -> Boolean
* Boolean
True = Boolean
True
	Boolean
_ * Boolean
_ = Boolean
False

instance Monoid Boolean where
	zero :: Boolean
zero = Boolean
False

instance Quasiring Boolean where
	one :: Boolean
one = Boolean
True