mapBoth
EitherのLeft と Right の両方を変換する
要はbimap
型
code:haskell
mapBoth :: (a -> c) -> (b -> d) -> Either a b -> Either c d
実装例
code:haskell
mapBoth f g (Left a) = Left (f a)
mapBoth f g (Right b) = Right (g b)