FuturePseudoCompanionOps
The scala standard library is extremely annoying because various effects don't have similar syntax for essentially the same operation.
Value members
Concrete methods
Similar to scala.concurrent.Future.sequence, but discards all content. i.e. used only for the combined effects.
Similar to scala.concurrent.Future.sequence, but discards all content. i.e. used only for the combined effects.
- See also
scala.concurrent.Future.sequence
Similar to scala.concurrent.Future.sequence, but discards all content. i.e. used only for the combined effects.
Similar to scala.concurrent.Future.sequence, but discards all content. i.e. used only for the combined effects.
- See also
scala.concurrent.Future.sequence
Syntactically inspired from Future.traverse, but it differs semantically insofar as this method does not attempt to run any futures in parallel. "M" stands for "monadic", as opposed to "applicative" which is the foundation for the formal definition of "traverse" (even though in Scala it is by accident-ish)
Syntactically inspired from Future.traverse, but it differs semantically insofar as this method does not attempt to run any futures in parallel. "M" stands for "monadic", as opposed to "applicative" which is the foundation for the formal definition of "traverse" (even though in Scala it is by accident-ish)
For the vast majority of cases you should prefer this method over Future.sequence and Future.traverse, since even small collections can easily wind up queuing so many Futures that you blow your execution context.
Usage:
import busymachines.pureharm.effects.implicits._
val patches: Seq[Patch] = //...
//this ensures that no two changes will be applied in parallel.
val allPatches: Future[Seq[Patch]] = Future.serialize(patches){ patch: Patch =>
Future {
//apply patch
}
}
//... and so on, and so on!
- See also
serialize Similar to serialize, but discards all content. i.e. used only for the combined effects.
Similar to scala.concurrent.Future.traverse, but discards all content. i.e. used only for the combined effects.
Similar to scala.concurrent.Future.traverse, but discards all content. i.e. used only for the combined effects.
- See also
scala.concurrent.Future.traverse