我想知道,为什么这不起作用(2个错误):
removeCard cardList card e =
if length $ (filter` cardList) == (length cardList)
-- the same error
-- if length $ filter` cardList == length cardList
-- if (length $ filter` cardList) == (length cardList)
then error "The error occured"
else filter` cardList
where
filter` [] = []
filter` (x:xs) = if x == card then xs else x : filter` xs
如果我只是用一个简单的表达式替换 if if 1 == 2 ...
,我会得到另一个错误:
parse error on input `where'