diff --git a/core/src/main/scala/cats/data/EitherT.scala b/core/src/main/scala/cats/data/EitherT.scala index 658cdd0f67..2bcd268d9d 100644 --- a/core/src/main/scala/cats/data/EitherT.scala +++ b/core/src/main/scala/cats/data/EitherT.scala @@ -31,7 +31,7 @@ final case class EitherT[F[_], A, B](value: F[Either[A, B]]) { case Right(b) => F.pure(b) } - def orElse[AA, BB >: B](default: => EitherT[F, AA, BB])(implicit F: Monad[F]): EitherT[F, AA, BB] = + def orElse[C, BB >: B](default: => EitherT[F, C, BB])(implicit F: Monad[F]): EitherT[F, C, BB] = EitherT(F.flatMap(value) { case Left(_) => default.value case r @ Right(_) => F.pure(r.leftCast) @@ -85,8 +85,7 @@ final case class EitherT[F[_], A, B](value: F[Either[A, B]]) { applicativeG: Applicative[G]): G[EitherT[F, C, D]] = applicativeG.map(traverseF.traverse(value)(axb => Bitraverse[Either].bitraverse(axb)(f, g)))(EitherT.apply) - def biflatMap[AA >: A, BB >: B](fa: A => EitherT[F, AA, BB], - fb: B => EitherT[F, AA, BB])(implicit F: FlatMap[F]): EitherT[F, AA, BB] = + def biflatMap[C, D](fa: A => EitherT[F, C, D], fb: B => EitherT[F, C, D])(implicit F: FlatMap[F]): EitherT[F, C, D] = EitherT(F.flatMap(value) { case Left(a) => fa(a).value case Right(a) => fb(a).value @@ -122,7 +121,7 @@ final case class EitherT[F[_], A, B](value: F[Either[A, B]]) { def leftMap[C](f: A => C)(implicit F: Functor[F]): EitherT[F, C, B] = bimap(f, identity) - def leftFlatMap[BB >: B, D](f: A => EitherT[F, D, BB])(implicit F: Monad[F]): EitherT[F, D, BB] = + def leftFlatMap[BB >: B, C](f: A => EitherT[F, C, BB])(implicit F: Monad[F]): EitherT[F, C, BB] = EitherT(F.flatMap(value) { case Left(a) => f(a).value case r @ Right(_) => F.pure(r.leftCast) @@ -248,7 +247,7 @@ final case class EitherT[F[_], A, B](value: F[Either[A, B]]) { * res0: EitherT[Option, NonEmptyList[Error], Int] = EitherT(Some(Left(NonEmptyList(error 1, error 2, error 3)))) * }}} */ - def withValidated[AA, BB](f: Validated[A, B] => Validated[AA, BB])(implicit F: Functor[F]): EitherT[F, AA, BB] = + def withValidated[C, D](f: Validated[A, B] => Validated[C, D])(implicit F: Functor[F]): EitherT[F, C, D] = EitherT(F.map(value)(either => f(either.toValidated).toEither)) def show(implicit show: Show[F[Either[A, B]]]): String = show.show(value)