Here is the type signature and the definition of the filter
function from Learn You a Haskell for Great Good!:
filter' :: (a -> Bool) -> [a] -> [a]
filter' _ [] = []
filter' p (x:xs)
| p x = x : filter' p xs
| otherwise = filter' p xs
An usage example in the book is with elem
is as follows:
filter' (`elem` ['a'..'z']) "Hell0!"
Which returns:
"ell"
In this particular example, is there a possible way of using elem
as a prefix function instead of an infix function as a predicate?
In a more general sense, is there a way to supply only the second parameter in order to partially apply a prefix function?
Thanks in advance for your help!