Future

object Future
Companion
class
trait Sum
trait Mirror
class Object
trait Matchable
class Any

Type members

Classlikes

case
class Async[+A](onFinish: A => Trampoline[Unit] => Unit) extends Future[A]
case
class BindAsync[A, B](onFinish: A => Trampoline[Unit] => Unit, f: A => Future[B]) extends Future[B]
case
class BindSuspend[A, B](thunk: () => Future[A], f: A => Future[B]) extends Future[B]
case
class Now[+A](a: A) extends Future[A]
case
class Suspend[+A](thunk: () => Future[A]) extends Future[A]

Types

type for Futures which need to be executed in parallel when using an Applicative instance

type for Futures which need to be executed in parallel when using an Applicative instance

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Inherited from
Mirror

Value members

Concrete methods

def apply[A](a: => A)(implicit pool: ExecutorService): Future[A]

Create a Future that will evaluate a using the given ExecutorService.

Create a Future that will evaluate a using the given ExecutorService.

def async[A](listen: A => Unit => Unit): Future[A]

Create a Future from an asynchronous computation, which takes the form of a function with which we can register a callback. This can be used to translate from a callback-based API to a straightforward monadic version. See Task.async for a version that allows for asynchronous exceptions.

Create a Future from an asynchronous computation, which takes the form of a function with which we can register a callback. This can be used to translate from a callback-based API to a straightforward monadic version. See Task.async for a version that allows for asynchronous exceptions.

def delay[A](a: => A): Future[A]

Promote a non-strict value to a Future. Note that since Future is unmemoized, this will recompute a each time it is sequenced into a larger computation. Memoize a with a lazy value before calling this function if memoization is desired.

Promote a non-strict value to a Future. Note that since Future is unmemoized, this will recompute a each time it is sequenced into a larger computation. Memoize a with a lazy value before calling this function if memoization is desired.

def fork[A](a: => Future[A])(implicit pool: ExecutorService): Future[A]

Returns a Future that produces the same result as the given Future, but forks its evaluation off into a separate (logical) thread, using the given ExecutorService. Note that this forking is only described by the returned Future--nothing occurs until the Future is run.

Returns a Future that produces the same result as the given Future, but forks its evaluation off into a separate (logical) thread, using the given ExecutorService. Note that this forking is only described by the returned Future--nothing occurs until the Future is run.

def gatherUnordered[A](fs: Seq[Future[A]]): Future[List[A]]

Calls Nondeterminism[Future].gatherUnordered.

Calls Nondeterminism[Future].gatherUnordered.

Since

7.0.3

def now[A](a: A): Future[A]

Convert a strict value to a Future.

Convert a strict value to a Future.

def reduceUnordered[A, M](fs: Seq[Future[A]])(implicit R: Reducer[A, M]): Future[M]
def schedule[A](a: => A, delay: Duration)(implicit pool: ScheduledExecutorService): Future[A]

Create a Future that will evaluate a after at least the given delay.

Create a Future that will evaluate a after at least the given delay.

def suspend[A](f: => Future[A]): Future[A]

Produce f in the main trampolining loop, Future.step, using a fresh call stack. The standard trampolining primitive, useful for avoiding stack overflows.

Produce f in the main trampolining loop, Future.step, using a fresh call stack. The standard trampolining primitive, useful for avoiding stack overflows.

Implicits

Implicits

This Applicative instance runs Futures in parallel.

This Applicative instance runs Futures in parallel.

It is different from the Applicative instance obtained from Monad[Future] which runs futures sequentially.