Skip to content

Commit

Permalink
chore: rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
GreyPlane committed May 23, 2023
1 parent 1db5502 commit 9b99ea5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/src/main/scala/cats/data/EitherT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -849,17 +849,17 @@ object EitherT extends EitherTInstances {
* scala> import cats._, data._, implicits._
* scala> val f: Unit => String = Function.const("panic!")
* scala> val a: Option[Int] = None
* scala> val b: EitherT[Option, String, Int] = EitherT.liftRedeemK[Option, Unit, String](f).apply(a)
* scala> val b: EitherT[Option, String, Int] = EitherT.liftAdaptErrorK[Option, Unit, String](f).apply(a)
* scala> b.value
* res0: Option[Either[String, Int]] = Some(Left(panic!))
*
* scala> val a2: Option[Int] = Some(42)
* scala> val b2: EitherT[Option, String, Int] = EitherT.liftRedeemK[Option, Unit, String](f).apply(a2)
* scala> val b2: EitherT[Option, String, Int] = EitherT.liftAdaptErrorK[Option, Unit, String](f).apply(a2)
* scala> b2.value
* res1: Option[Either[String, Int]] = Some(Right(42))
* }}}
*/
final def liftRedeemK[F[_], EA, EB](fe: EA => EB)(implicit F: ApplicativeError[F, EA]): F ~> EitherT[F, EB, *] =
final def liftAdaptErrorK[F[_], EA, EB](fe: EA => EB)(implicit F: ApplicativeError[F, EA]): F ~> EitherT[F, EB, *] =
new (F ~> EitherT[F, EB, *]) {
def apply[A](fa: F[A]): EitherT[F, EB, A] = EitherT(F.redeem(fa)(ea => Left(fe(ea)), Right.apply))
}
Expand Down

0 comments on commit 9b99ea5

Please sign in to comment.