diff --git a/core/src/main/scala/cats/data/EitherT.scala b/core/src/main/scala/cats/data/EitherT.scala index 66915a74042..1f5cc7416d0 100644 --- a/core/src/main/scala/cats/data/EitherT.scala +++ b/core/src/main/scala/cats/data/EitherT.scala @@ -218,6 +218,21 @@ trait EitherTFunctions { final def pure[F[_], A, B](b: B)(implicit F: Applicative[F]): EitherT[F, A, B] = right(F.pure(b)) + /** + * Alias for [[right]] + * {{{ + * scala> import cats.data.EitherT + * scala> import cats.implicits._ + * scala> val o: Option[Int] = Some(3) + * scala> val n: Option[Int] = None + * scala> EitherT.liftT(o) + * res0: cats.data.EitherT[Option,Nothing,Int] = EitherT(Some(Right(3))) + * scala> EitherT.liftT(n) + * res1: cats.data.EitherT[Option,Nothing,Int] = EitherT(None) + * }}} + */ + final def liftT[F[_], A, B](fb: F[B])(implicit F: Functor[F]): EitherT[F, A, B] = right(fb) + /** Transforms an `Either` into an `EitherT`, lifted into the specified `Applicative`. * * Note: The return type is a FromEitherPartiallyApplied[F], which has an apply method