final class ApplicativeErrorOps[F[_], E, A] extends AnyVal
- Alphabetic
- By Inheritance
- ApplicativeErrorOps
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new ApplicativeErrorOps(fa: F[A])
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
def
adaptErr(pf: PartialFunction[E, E])(implicit F: ApplicativeError[F, E]): F[A]
Transform certain errors using
pf
and rethrow them.Transform certain errors using
pf
and rethrow them. Non matching errors and successful values are not affected by this function.Example:
scala> import cats._, implicits._ scala> def pf: PartialFunction[String, String] = { case "error" => "ERROR" } scala> "error".asLeft[Int].adaptErr(pf) res0: Either[String,Int] = Left(ERROR) scala> "err".asLeft[Int].adaptErr(pf) res1: Either[String,Int] = Left(err) scala> 1.asRight[String].adaptErr(pf) res2: Either[String,Int] = Right(1)
This is the same as
MonadErrorOps#adaptError
. It cannot have the same name because this would result in ambiguous implicits. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def attempt(implicit F: ApplicativeError[F, E]): F[Either[E, A]]
- def attemptNarrow[EE <: Throwable](implicit F: ApplicativeError[F, E], tag: ClassTag[EE], ev: <:<[EE, E]): F[Either[EE, A]]
- def attemptT(implicit F: ApplicativeError[F, E]): EitherT[F, E, A]
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
- def handleError(f: (E) ⇒ A)(implicit F: ApplicativeError[F, E]): F[A]
- def handleErrorWith(f: (E) ⇒ F[A])(implicit F: ApplicativeError[F, E]): F[A]
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def onError(pf: PartialFunction[E, F[Unit]])(implicit F: ApplicativeError[F, E]): F[A]
- def orElse(other: ⇒ F[A])(implicit F: ApplicativeError[F, E]): F[A]
-
def
orRaise(other: ⇒ E)(implicit F: ApplicativeError[F, E]): F[A]
Handle all errors on this F[A] by raising an error using the given value.
Handle all errors on this F[A] by raising an error using the given value.
Example:
scala> import cats._, implicits._ scala> val fa: Either[String, Int] = Left("wrong") scala> fa.orRaise("wronger") res1: Either[String,Int] = Left(wronger) scala> val fb: Either[String, Int] = Right(42) scala> fb.orRaise("wrongest") res2: Either[String,Int] = Right(42)
- def recover(pf: PartialFunction[E, A])(implicit F: ApplicativeError[F, E]): F[A]
- def recoverWith(pf: PartialFunction[E, F[A]])(implicit F: ApplicativeError[F, E]): F[A]
- def redeem[B](recover: (E) ⇒ B, f: (A) ⇒ B)(implicit F: ApplicativeError[F, E]): F[B]
-
def
toString(): String
- Definition Classes
- Any