I'll steal Régis Jean-Gilles' excellent answer from https://stackoverflow.com/a/16358119/3328933
"Futures are executed on a dedicated thread pool. If your main program does not wait for the future, it will exit immediately and the future won't have a chance to execute. What you can do here is to use Await in your main program to block the main thread until the future executes:"
package reactive
import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.future
import scala.concurrent.duration._
object futuresum extends App {
def f1 = future { 12 }
def f2 = future { 13 }
val result1 = f1.flatMap(x => f2.map(y => x + y))
result1 onSuccess { case res => println(res) }
Await.result(result1, 2 seconds)
val result2 = for (x <- f1; y <- f2) yield (x + y)
result2 onSuccess { case res => println(res) }
Await.result(result2, 2 seconds)
}