additions to Data.Map
Ross Paterson
ross at soi.city.ac.uk
Fri Aug 11 09:21:20 EDT 2006
I'd like to propose the following additions to Data.Map (and IntMap):
-- | /O(n)/. Map values and collect the 'Just' results.
mapMaybe :: Ord k => (a -> Maybe b) -> Map k a -> Map k b
-- | /O(n)/. Map keys\/values and collect the 'Just' results.
mapMaybeWithKey :: Ord k => (k -> a -> Maybe b) -> Map k a -> Map k b
-- | /O(n)/. Map values and separate the 'Left' and 'Right' results.
mapEither :: Ord k => (a -> Either b c) -> Map k a -> (Map k b, Map k c)
-- | /O(n)/. Map keys\/values and separate the 'Left' and 'Right' results.
mapEitherWithKey :: Ord k =>
(k -> a -> Either b c) -> Map k a -> (Map k b, Map k c)
More information about the Libraries
mailing list