Reputation: 31546
In scala 2.12 I can write the following code
import scala.concurrent._
import scala.concurrent.ExecutionContext.Implicits.global
val x = Future(Future(10))
val y = x.flatten
However, scala 2.11 does not provide a flatten method. Any idea how can I achieve the same result in scala 2.11
edit: Can the cats library help?
Upvotes: 3
Views: 316
Reputation: 4239
Don't know about Cats, but Scalaz has method join
for that:
val y = x.join
Moreover, this method works for all Monads.
Upvotes: 1