module Data.Carbonara.List where notNull :: [a] -> Bool notNull = not . null replaceBy :: (a -> Bool) -> a -> [a] -> [a] replaceBy f new xs = map (\x -> if f x then new else x) xs -- | replaceBy (=='b') 'l' "book" --> "look" -- | replaceBy (<0) 0 [-4,-5,7] --> [0,0,7]