Reputation: 892
I'm trying to filter everything from a string other than letters or spaces by combining isLetter and isSpace conditions, but this didn't work.
normalise = filter (\x -> (Char.isLetter || Char.isSpace))
Is there a way to filter for one condition or another?
Upvotes: 2
Views: 909
Reputation: 1766
You can also do it using combinators like this:
import Control.Arrow
normalise = filter ((Char.isLetter &&& Char.isSpace) >>> uncurry (||))
Upvotes: 0
Reputation: 981
You are missing function application in your lambda. It should be:
normalise = filter (\x -> Char.isLetter x || Char.isSpace x)
Upvotes: 7