FuturePseudoCompanionOps

final class FuturePseudoCompanionOps extends AnyVal

The scala standard library is extremely annoying because various effects don't have similar syntax for essentially the same operation.

class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def pure[A](a: A): Future[A]
def raiseError[A](t: Throwable): Future[A]
@inline
def sequence_[A](in: Seq[Future[A]])(implicit ec: ExecutionContext): Future[Unit]

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

@inline
def sequence_[A](in: Set[Future[A]])(implicit ec: ExecutionContext): Future[Unit]

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

@inline
def serialize[A, B, C <: ([X] =>> IterableOnce[X])](col: C[A])(fn: A => Future[B])(implicit cbf: BuildFrom[C[A], B, C[B]], ec: ExecutionContext): Future[C[B]]

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!
@inline
def serialize_[A, B, C <: ([X] =>> IterableOnce[X])](col: C[A])(fn: A => Future[B])(implicit cbf: BuildFrom[C[A], B, C[B]], ec: ExecutionContext): Future[Unit]
See also

serialize Similar to serialize, but discards all content. i.e. used only for the combined effects.

@inline
def traverse_[A, B](in: Seq[A])(fn: A => Future[B])(implicit ec: ExecutionContext): Future[Unit]

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

@inline
def traverse_[A, B](in: Set[A])(fn: A => Future[B])(implicit ec: ExecutionContext): Future[Unit]

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

Concrete fields

val companion: Future