either
LeftとRightの値を処理する関数を渡してEitherを取り除く
code:hs
either :: (e -> c) -> (a -> c) -> Either e a -> c
例
code:hs
import Data.Either
test = either (+ 1) (* 2)
main = do
print $ test (Left 4) -- 5
print $ test (Right 4) -- 8