I was hoping to find a better way to solve a problem I've encountered in Haskell.
Given a list and a condition create a new list with only elements which satisfy the condition. Below is a solution I used. Is there a better alternative which doesn't involve maybes?
eg :: (Eq a, Num a) => (a -> Bool) -> [a] -> [a]
eg cond i = catMaybes (map (\x-> if cond x then Just x else Nothing) i)