Skip to content

Instantly share code, notes, and snippets.

@AlexRogalskiy
Created December 19, 2020 20:33
Show Gist options
  • Save AlexRogalskiy/f0324bfa2047633b6ce6af5cfc74e857 to your computer and use it in GitHub Desktop.
Save AlexRogalskiy/f0324bfa2047633b6ce6af5cfc74e857 to your computer and use it in GitHub Desktop.
Try to Future mapping
import scala.util.{Failure, Success, Try}
import scala.concurrent.future
implicit def tryToFuture[T](t: Try[T]): Future[T] = t match {
case Success(s) => Future.successful(s)
case Failure(t) => Future.failed(t)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment