Skip to content

Generalised transformation functions. #255

@jonathanknowles

Description

@jonathanknowles

Consider adding the following functions:

withMap

withMap
    :: MonoidNull v2
    => (Map k1 v1 -> Map k2 v2)
    -> (MonoidMap k1 v1 -> MonoidMap k2 v2)
withMap f = fromMap . f . toMap

withMapKeys

Applies a transformation that is guaranteed to neither create nor modify values, avoiding the need to perform a post-processing step that removes null values.

withMapKeys
    :: (forall x. Map k1 x -> Map k2 x)
    -> (MonoidMap k1 v -> MonoidMap k2 v)
withMapKeys f (MonoidMap m) = MonoidMap (f m)  

See: 3deb419

Metadata

Metadata

Labels

ideaIdea for improvement

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions