Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- + implicit class RecoveringFutureEitherT[F[_], A, B](underlying: EitherT[F, A, B])(
- + implicit me: MonadError[F, Throwable]) {
- +
- + type MyEitherT[BB] = EitherT[F, A, BB]
- +
- + def recoverF(pf: PartialFunction[Throwable, A]): EitherT[F, A, B] =
- + MonadError[MyEitherT, Throwable].recoverWith(underlying) {
- + case th => EitherT.fromEither[F](pf(th).asLeft[B])
- + }
- + }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement