Packages

c

cats.syntax

TryOps

final class TryOps[A] extends AnyVal

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

Instance Constructors

  1. new TryOps(self: Try[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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  6. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  7. def liftTo[F[_]](implicit F: ApplicativeThrow[F]): F[A]

    lift the try into a F[_] with ApplicativeThrow[F] instance

    lift the try into a F[_] with ApplicativeThrow[F] instance

    scala> import cats.implicits._
    scala> import util.Try
    
    scala> val s: Try[Int] = Try(3)
    scala> s.liftTo[Either[Throwable, *]]
    res0: Either[Throwable, Int] = Right(3)
    
    scala> val f: Try[Int] = Try(throw new Throwable("boo"))
    scala> f.liftTo[Either[Throwable, *]]
    res0: Either[Throwable, Int] = Left(java.lang.Throwable: boo)
  8. def toString(): String
    Definition Classes
    Any
  9. def toValidated: Validated[Throwable, A]

    transforms the try to a Validated[Throwable, A] instance

    transforms the try to a Validated[Throwable, A] instance

    scala> import cats.syntax.try_._
    scala> import cats.data.Validated
    scala> import util.Try
    
    scala> val s: Try[Int] = Try(3)
    scala> s.toValidated
    res0: Validated[Throwable, Int] = Valid(3)
    
    scala> val f: Try[Int] = Try(throw new Throwable("boo"))
    scala> f.toValidated
    res0: Validated[Throwable, Int] = Invalid(java.lang.Throwable: boo)

Inherited from AnyVal

Inherited from Any

Ungrouped