Making a ternary logic table, and I would like to make my own function for an operator that I\'ll call <=>.
So, for example, I want to do this, but
Since you have Eq and Ord, you can do the following:
data Ternary = T | F | M
deriving (Eq, Show, Ord)
(<=>) :: Ternary -> Ternary -> Ternary
x <=> y = if x == y then T else max x y
If you do happen to change it so that M <=> M == M, then you can do the following:
data Ternary = M | T | F
deriving (Eq, Show, Ord, Enum)
(<=>) :: Ternary -> Ternary -> Ternary
x <=> y = fromEnum $ rem (toEnum x * toEnum y) 3