I think there's a generalization hidden in those examples somewhere. It feels like some sort of
leftFlatten (Although you're not flattening anything)
I get what you're trying to do, but how did you end up with Either[.., Either[..]] in the first place?
I'll need to spend some time thinking about the laws for these typeclasses, for some reason I don't think the EitherT and ZIO instance in your example is behaving the same
This is the definition of MonadError for EitherT
implicit def catsDataMonadErrorFForEitherT[F[_], E, L]( implicit FE0: MonadError[F, E] ): MonadError[EitherT[F, L, ?], E]
So let's say your monad is EitherT[cats.effect.IO, MyError, Unit], the MonadError instance you have is MonadError[IO, Throwable]
Option[String] | Option[Int]won't work due to type erasure