Maps a function over both elements of a bifunctor.
bimapBoth length ([True], [False, True])(1,2)map (bimapBoth not) [Left True, Right False][Left False,Right True]
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Modulerelude-1.2.0.0Haskell2010
SPDX-License-Identifier : MIT Maintainer : Kowainik xrom.xkov@gmail.com Stability : Stable Portability : Portable
Useful combinators for bifunctors inside functors. This set of functions is useful when you want to work with types like these ones:
foo :: IO (Either a b)
bar :: IO (a, b)
baz :: Maybe (Either a b)
qux :: Maybe (a, b)
doo :: (a, a)
dee :: Either a a
Maps a function over both elements of a bifunctor.
bimapBoth length ([True], [False, True])(1,2)map (bimapBoth not) [Left True, Right False][Left False,Right True]
Fmaps functions for nested bifunctor. Short for fmap (bimap f g).
bimapF not length $ Just (False, ['a', 'b'])Just (True,2)
Short for fmap . first.
firstF not $ Just (False, ['a', 'b'])Just (True,"ab")
Short for fmap . second.
secondF length $ Just (False, ['a', 'b'])Just (False,2)