Result.orElse()
失敗したら、代わりのResultを返す、というもの
Rightの場合は、そのままRightを返す
Leftの場合は、関数を適用してResultを返す
Result.andThen()のLeft版
hsで書くなら
code:hs
orElse :: Either a b -> (a -> Either c b) -> Either c b
orElse (Right x) _ = Right x
orElse (Left e) f = f e
Preludeにこういう関数は用意されていない