final class TryOps[A] extends AnyVal
- Alphabetic
- By Inheritance
- TryOps
- AnyVal
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
getClass(): Class[_ <: AnyVal]
- Definition Classes
- AnyVal → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
liftTo[F[_]](implicit F: ApplicativeThrow[F]): F[A]
lift the
try
into aF[_]
withApplicativeThrow[F]
instancelift the
try
into aF[_]
withApplicativeThrow[F]
instancescala> 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)
-
def
toString(): String
- Definition Classes
- Any
-
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)