Packages

c

cats.syntax

ApplicativeErrorOps

final class ApplicativeErrorOps[F[_], E, A] extends AnyVal

Source
applicativeError.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ApplicativeErrorOps
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ApplicativeErrorOps(fa: F[A])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. 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.

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def attempt(implicit F: ApplicativeError[F, E]): F[Either[E, A]]
  7. def attemptNarrow[EE <: Throwable](implicit F: ApplicativeError[F, E], tag: ClassTag[EE], ev: <:<[EE, E]): F[Either[EE, A]]
  8. def attemptT(implicit F: ApplicativeError[F, E]): EitherT[F, E, A]
  9. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  10. def handleError(f: (E) ⇒ A)(implicit F: ApplicativeError[F, E]): F[A]
  11. def handleErrorWith(f: (E) ⇒ F[A])(implicit F: ApplicativeError[F, E]): F[A]
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. def onError(pf: PartialFunction[E, F[Unit]])(implicit F: ApplicativeError[F, E]): F[A]
  14. def orElse(other: ⇒ F[A])(implicit F: ApplicativeError[F, E]): F[A]
  15. 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)
  16. def recover(pf: PartialFunction[E, A])(implicit F: ApplicativeError[F, E]): F[A]
  17. def recoverWith(pf: PartialFunction[E, F[A]])(implicit F: ApplicativeError[F, E]): F[A]
  18. def redeem[B](recover: (E) ⇒ B, f: (A) ⇒ B)(implicit F: ApplicativeError[F, E]): F[B]
  19. def toString(): String
    Definition Classes
    Any

Inherited from AnyVal

Inherited from Any

Ungrouped