daily pastebin goal
32%
SHARE
TWEET

Untitled

a guest Mar 12th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. +  implicit class RecoveringFutureEitherT[F[_], A, B](underlying: EitherT[F, A, B])(
  2. +    implicit me: MonadError[F, Throwable]) {
  3. +
  4. +    type MyEitherT[BB] = EitherT[F, A, BB]
  5. +
  6. +    def recoverF(pf: PartialFunction[Throwable, A]): EitherT[F, A, B] =
  7. +      MonadError[MyEitherT, Throwable].recoverWith(underlying) {
  8. +        case th => EitherT.fromEither[F](pf(th).asLeft[B])
  9. +      }
  10. +  }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top