How do I create an operator in Haskell?

前端 未结 4 1537
栀梦
栀梦 2021-02-03 22:24

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

4条回答
  •  悲哀的现实
    2021-02-03 22:32

    You can simplify (line-wise) the definition as follows:

    (<=>) :: Ternary -> Ternary -> Ternary
    T <=> T = T
    F <=> F = T
    M <=> M = T
    M <=> _ = M
    _ <=> M = M
    _ <=> _ = F
    

提交回复
热议问题