Packages

package future

The name space that contains Future and utilities for Future.

Usage

Features of Future are provided as implicit views or type classes. To enable those features, import all members under future along with Scalaz syntax.

import scalaz.syntax.all._
import com.thoughtworks.future._
Author:

杨博 (Yang Bo)

Source
future.scala
Linear Supertypes
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. future
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type Future[+A] = future.OpaqueTypes.Future[A]

    An asynchronous task.

    An asynchronous task.

    Note

    Unlike scala.concurrent.Future, this Future is not memoized by default.

    var count = 0
    val notMemoized = Future.delay {
      count += 1
    }
    count should be(0);
    (
      for {
        _ <- notMemoized
        _ = count should be(1)
        _ <- notMemoized
        _ = count should be(2)
        _ <- notMemoized
      } yield (count should be(3))
    ).toScalaFuture
    ,

    A Future can be memoized manually by converting this Future to a scala.concurrent.Future and then converting back.

    var count = 0
    val notMemoized = Future.delay {
      count += 1
    }
    val memoized = notMemoized.toScalaFuture.toThoughtworksFuture;
    (
      for {
        _ <- memoized
        _ = count should be(1)
        _ <- memoized
        _ = count should be(1)
        _ <- memoized
      } yield (count should be(1))
    ).toScalaFuture
    See also

    ParallelFuture for parallel version of this Future.

    ThoughtworksFutureOps for methods available on this Future.

  2. final case class MultipleException(throwableSet: Set[Throwable]) extends RuntimeException with Product with Serializable
  3. type ParallelFuture[A] = AnyRef { ... /* 2 definitions in type refinement */ }

    Parallel-tagged type of Future that needs to be executed in parallel when using an scalaz.Applicative instance

  4. implicit final class ScalaFutureToThoughtworksFutureOps[A] extends AnyRef

    Extension methods for scala.concurrent.Future

  5. implicit final class ThoughtworksFutureOps[A] extends AnyVal

    Extension methods for Future

  6. implicit final class UnitContinuationToThoughtworksFutureOps[A] extends AnyRef

    Extension methods for UnitContinuation

Value Members

  1. implicit def futureMonadError: MonadError[Future, Throwable] with BindRec[Future]

    Annotations
    @inline()
  2. implicit def futureParallelApplicative(implicit throwableSemigroup: Semigroup[Throwable]): Applicative[ParallelFuture]

    Annotations
    @inline()
  3. implicit val multipleExceptionThrowableSemigroup: future.MultipleException.multipleExceptionThrowableSemigroup.type
  4. object Future extends JvmFutureCompanion
  5. object MultipleException extends Serializable

Inherited from AnyRef

Inherited from Any

Implicit Views

Type class instances

Ungrouped