Created
September 25, 2018 16:21
-
-
Save Tvaroh/207ba3b287e12d33b113df1a0583eab8 to your computer and use it in GitHub Desktop.
Revisions
-
Tvaroh created this gist
Sep 25, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import scala.concurrent.Future /** Typeclass for interoperating with legacy code which uses Scala futures. */ trait ExecuteUnsafe[F[_]] { def unsafeToFuture[T](mt: F[T]): Future[T] } object ExecuteUnsafe { def apply[F[_]: ExecuteUnsafe]: ExecuteUnsafe[F] = implicitly[ExecuteUnsafe[F]] implicit val future: ExecuteUnsafe[Future] = FutureExecuteUnsafe private object FutureExecuteUnsafe extends ExecuteUnsafe[Future] { override def unsafeToFuture[T](future: Future[T]): Future[T] = future } }