Skip to content

v2.0.0-beta13

Compare
Choose a tag to compare
@kevin-lee kevin-lee released this 30 Sep 15:41
· 42 commits to main since this release
58e7f93

2.0.0-beta13 - 2023-10-01

Changes

  • CanHandleError[Future] and CanRecover[Future] should use Future's recover and recoverWith. (#584)
  • CanHandleError[Try].handleNonFatal and CanRecover[Try].recoverFromNonFatal should use Try's recover (#586)

New Feature

  • rethrowIfLeft and rethrowTIfLeft syntax for F[Either[A, B]] and EitherT[F, A, B] (#588)

    val fa: IO[Either[Throwable, Int]] = pureOf[IO](Right(1))
    fa.rethrowIfLeft
    // IO[Int] = IO(1)
    val fa: IO[Either[Throwable, Int]] = pureOf[IO](Left(new RuntimeException("Error")))
    fa.rethrowIfLeft
    // IO[Int] = RaiseError(RuntimeException("ERROR"))
    val fa: EitherT[IO, Throwable, Int] = pureOf[IO](Right(1)).eitherT
    fa.rethrowTIfLeft
    // IO[Int] = IO(1)
    val fa: EitherT[IO, Throwable, Int] = pureOf[IO](Left(new RuntimeException("Error"))).eitherT
    fa.rethrowTIfLeft
    // IO[Int] = RaiseError(RuntimeException("ERROR"))