:: (a -> c) -> (b -> d) -> Either a b -> Either c d

The mapBoth function takes two functions and applies the first if iff the value takes the form Left _ and the second if the value takes the form Right _. Using Data.Bifunctor:
mapBoth = bimap
Using Control.Arrow:
mapBoth = (+++)
>>> mapBoth (*2) (*3) (Left 4)
Left 8
>>> mapBoth (*2) (*3) (Right 4)
Right 12
The mapBoth function takes two functions and applies the first if iff the value takes the form 'Left _' and the second if the value takes the form 'Right _'.
Map over both arguments at the same time.
bimap f g ≡ first f . second g

Examples

>>> bimap toUpper (+1) ('j', 3)
('J',4)
>>> bimap toUpper (+1) (Left 'j')
Left 'J'
>>> bimap toUpper (+1) (Right 3)
Right 4
A default definition of bimap in terms of the Bitraversable operations.
bimapDefault f g ≡
runIdentity . bitraverse (Identity . f) (Identity . g)
Map functions over both the Node and Edge labels in a graph.
Generic implementation of bimap from Bifunctor. See also GenericBifunctor.
Lift conversion to symbolic functions to binary type constructors.