Created
December 10, 2015 14:59
-
-
Save bthuillier/df8107dee5bb90b1cdbb to your computer and use it in GitHub Desktop.
This file contains 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 characters
@ import scala.concurrent.{ Future, ExecutionContext } | |
import scala.concurrent.{ Future, ExecutionContext } | |
@ import scala.concurrent.ExecutionContext.Implicits._ | |
import scala.concurrent.ExecutionContext.Implicits._ | |
@ { | |
def testF[A](x: => Future[A]): Future[A] = { | |
println("here") | |
val future = x | |
future | |
} | |
} | |
defined function testF | |
@ testF(Future { println("in future") }) | |
here | |
in future | |
res19: Future[Unit] = scala.concurrent.impl.Promise$DefaultPromise@4e6a286d | |
@ testF(Future.successful(println("in future"))) | |
here | |
in future | |
res21: Future[Unit] = scala.concurrent.impl.Promise$KeptPromise@2870bb4a | |
@ testF(Future.failed {println("failed"); new Exception}) | |
here | |
failed | |
res23: Future[Nothing] = scala.concurrent.impl.Promise$KeptPromise@442bca3b | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment