bimap -is:exact
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
Not on Stackage, so not searched.
Bidirectional mapping between two key types
The
bimapAccumL function behaves like a combination of
bimap and
bifoldl; it traverses a structure from left to
right, threading a state of type
a and using the given
actions to compute new elements for the structure.
Examples
Basic usage:
>>> bimapAccumL (\acc bool -> (acc + 1, show bool)) (\acc string -> (acc * 2, reverse string)) 3 (True, "foo")
(8,("True","oof"))
The
bimapAccumR function behaves like a combination of
bimap and
bifoldr; it traverses a structure from right
to left, threading a state of type
a and using the given
actions to compute new elements for the structure.
Examples
Basic usage:
>>> bimapAccumR (\acc bool -> (acc + 1, show bool)) (\acc string -> (acc * 2, reverse string)) 3 (True, "foo")
(7,("True","oof"))
Not on Stackage, so not searched.
bijections with multiple implementations.
Not on Stackage, so not searched.
Two-column database server.