Skip to content

Generalise mapBoth to Bifunctor #174

@chshersh

Description

@chshersh

Currently we have the following mapBoth function in the Relude.Extra.Tuple module:

mapBoth :: (a -> b) -> (a, a) -> (b, b)
mapBoth f (a1, a2) = (f a1, f a2)

I propose to generalise the type signature of this function so it can work with any Bifunctor:

mapBoth :: Bifunctor f => (a -> b) -> f a a -> f b b

For this we need:

  • Move mapBoth to Relude.Extra.Bifunctor
  • Generalise and implement
  • Add more examples to the documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Hacktoberfesthttps://hacktoberfest.digitalocean.com/enhancementNew feature or requestextraRelude.Extra

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions