Object

com.thoughtworks

continuation

Related Doc: package thoughtworks

Permalink

object continuation

The name space that contains Continuation and utilities for Continuation.

Author:

杨博 (Yang Bo)

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

Type Members

  1. type Continuation[R, +A] = continuation.OpacityTypes.Continuation[R, A]

    Permalink

    The stack-safe and covariant version of scalaz.Cont.

    The stack-safe and covariant version of scalaz.Cont.

    Note

    The underlying type of this Continuation is ContT[Trampoline, R, _ <: A].

    See also

    UnitContinuation if you want to use this Continuation as an asynchronous task.

    ContinuationOps for extension methods for this Continuation.

  2. implicit final class ContinuationOps[R, A] extends AnyVal

    Permalink

    Extension methods for Continuation

  3. type ParallelContinuation[A] = AnyRef { ... /* 2 definitions in type refinement */ }

    Permalink

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

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

    Examples:
    1. Given two ParallelContinuations, each of them modifies a var,

      import com.thoughtworks.continuation._
      import scalaz.Tags.Parallel
      import scalaz.syntax.all._
      var count0 = 0
      var count1 = 0
      val pc0: ParallelContinuation[Unit] = Parallel(Continuation.delay {
        count0 += 1
      })
      val pc1: ParallelContinuation[Unit] = Parallel(Continuation.delay {
        count1 += 1
      })

      when map them together,

      val result: ParallelContinuation[Unit] = (pc0 |@| pc1) { (u0: Unit, u1: Unit) => }

      then the two vars have not been modified right now,

      count0 should be(0)
      count1 should be(0)

      when the result ParallelContinuation get done, then two vars should be modified only once for each.

      Parallel.unwrap(result).map { _: Unit =>
        count0 should be(1)
        count1 should be(1)
      }
    2. ,
    3. Given two ParallelContinuations that contain immediate values,

      import com.thoughtworks.continuation._
      import scalaz.Tags.Parallel
      import scalaz.syntax.all._
      val pc0: ParallelContinuation[Int] = Parallel(Continuation.now[Unit, Int](40))
      val pc1: ParallelContinuation[Int] = Parallel(Continuation.now[Unit, Int](2))

      when map them together,

      val result: ParallelContinuation[Int] = (pc0 |@| pc1)(_ + _)

      then the result should be a ParallelContinuation as well, and it is able to convert to a normal Continuation

      Parallel.unwrap(result).map {
        _ should be(42)
      }
  4. type UnitContinuation[+A] = continuation.OpacityTypes.Continuation[Unit, A]

    Permalink

    A Continuation whose response type is scala.Unit.

    A Continuation whose response type is scala.Unit.

    This UnitContinuation type can be used as an asynchronous task.

    Note

    This UnitContinuation type does not support exception handling.

    See also

    Future for asynchronous task that supports exception handling.

    ParallelContinuation for parallel version of this UnitContinuation.

    UnitContinuationOps for extension methods for this UnitContinuationOps.

  5. implicit final class UnitContinuationOps[A] extends AnyVal

    Permalink

    Extension methods for UnitContinuation

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. object Continuation

    Permalink

    The companion object for Continuation.

  5. object UnitContinuation

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. implicit def continuationMonad[R]: Monad[[+β$0$]continuation.OpacityTypes.Continuation[R, β$0$]] with BindRec[[+β$1$]continuation.OpacityTypes.Continuation[R, β$1$]] with Zip[[+β$2$]continuation.OpacityTypes.Continuation[R, β$2$]]

    Permalink

    Annotations
    @inline()
  9. implicit object continuationParallelApplicative extends Applicative[ParallelContinuation] with Zip[ParallelContinuation]

    Permalink

  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  20. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  21. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Implicit Views

Type class instances

Ungrouped