我是Haskell noob,在阅读关于Haskell Road中的含义时,我来到了下面的难题。有没有用于防护分析的工具?
verdict :: Bool -> Bool -> (Bool, String)
verdict p q | not result = (False, "LIAR")
| result && p = (True, "telling the truth")
| result = (True, "innocent unless proven guilty")
| otherwise = (False, "we shouldn't get here")
where result = (not p) || q
-- map (\x -> verdict (fst x == 1) (snd x == 1)) [(1,1),(1,0),(0,1),(0,0)]
是否有一种工具可以警告我有关其他或其他类似的逻辑错误?
请注意,您的'否则'子句真正无法访问:在'not result'和'result'之间涵盖了所有可能性。 – duplode