这是功能
toRevDigits :: Integer -> [Integer]
toRevDigits 0 = []
toRevDigits x
| x<0 = []
| otherwise = lastDigit x:(toRevDigits (dropLastDigit x))
这是测试
testRevDigits :: (Integer, [Integer]) -> Bool
testRevDigits (n, [d]) = toRevDigits n ==[n]
ex2Tests :: [Test]
ex2Tests = [Test "toRevDigits test" testRevDigits
[(321,[1,2,3]), (0,[]), ((-17),[])]
]
这是错误
*** Exception: LAB8Tests.hs:27:1-44: Non-exhaustive patterns in function testRevDigits
如何修复测试仪以使其正常工作?