大家好,我对 Haskell 比较陌生,并且仍在学习,为什么这不起作用?
filterFirst :: (a -> Bool) -> [a] -> [a]
filterFirst p xs = delete (not . p) (filter (not . p) xs)
当我在终端中收到以下错误消息时:
ERROR "FirstLiterate.lhs":58 - Type error in application
*** Expression : delete (not . p) (filter (not . p) xs)
*** Term : not . p
*** Type : a -> Bool
*** Does not match : a
*** Because : unification would give infinite type
所以我知道该类型与我定义中的类型不匹配。我怎样才能改变它,这样我就不必改变(a -> Bool)?