我正在尝试编写一个remove
函数,以便用户可以键入remove 'd' ["abc", "dc", "ad"]
并获取输出["abc", "c", "a"]
。
我的代码是:
remove :: Eq a => a -> [[a]] -> [[a]]
remove a (x:xs) = filter (not.a) (x:xs)
但我收到以下错误消息:
Occurs check: cannot construct the infinite type: a = [a] -> Bool
When generalising the type(s) for `remove'
错误消息是什么意思,如何更改第二行以使其正常工作?