As I understand it, flatMap - for example on Either passes-through Lefts and applies the mapping on the value of Rights.
Now, I wonder, if the reversed operation exists, too: Passing-through the Rights but applying the mapping on the value of Lefts.
Usecase: Given a method that returns an Either[BackendError, Value]. The result of this method should be mapped into an Either[WrappedBackendError, Value].
What I do now is:
val result: Either[BackendError, Value] = someMethod
result match {
case Left(error) => Left(WrappedBackendError(error))
case Right(value) => Right(value)
}