制作一个三元逻辑表,我想为我将调用的运算符制作自己的函数<=>
。
因此,例如,我想这样做,但这是不对的。这样做的正确方法是什么?
data Ternary = T | F | M
deriving (Eq, Show, Ord)
<=> :: Ternary -> Ternary -> Ternary
<=> T F = F
<=> T T = T
<=> T M = M
<=> F F = T
<=> F T = F
<=> F M = M
<=> M F = M
<=> M T = M
<=> M M = T