Nesting Eithers can be useful. Unnesting them with a
join is as well but it could be handy to account for the left parameter.
I'd like to propose this function for
joinEither :: (b -> c) -> Either c (Either b a) -> Either c a joinEither f = either Left (either (Left . f) Right)
joinEither id would be just plain
join. This function doesn't do much but the rest of functions in
Data.Either are of similar scope.
joinEither2 :: (b -> Either a c) -> Either c (Either b a) -> Either c a would be more generic but that feels intuitively wrong to me since Lefts aren't supposed to just turn into Rights.