class FutureThereafterAsync extends FutureThereafter with ThereafterAsync[Future]
- Alphabetic
- By Inheritance
- FutureThereafterAsync
- ThereafterAsync
- FutureThereafter
- Thereafter
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new FutureThereafterAsync()(implicit ec: ExecutionContext)
Type Members
- type Content[A] = Try[A]
The container type for computation result.
The container type for computation result.
Must contain at most one element of the given type parameter.
- Definition Classes
- FutureThereafter → Thereafter
- type Shape = Unit
Defines the shapes under which a Content does contain a single element of the type argument.
Defines the shapes under which a Content does contain a single element of the type argument. With withShape
(shape, x), we can uniquely reconstruct the Content from a valuexand itsshape, which is needed for implementing thereafter in terms of transformChaining.For example, if Content is
Either[String, *], then only the formRight(x)contains such an elementx. So they are all of the same shapeRightand so the shape can be any singleton type such asRight.typeorUnit. Conversely, if Content isTuple2(Int, *), then an elementxcan appear in many values, e.g.,(0, x)and(1, x)of different shapes. In this case, the shape type would beIntso that we can reconstruct(0, x)or(1, x)from the valuexand the corresponding shape0or1.Formally,
Shapeis the type of one-hole contexts for Content, also known as zippers, which is the derivative of Content/ As such,Shapeshould depend on its type argument. However, as Content contains at most element of the given argument type, its derivative is always constant. So we can omit the type argument altogether.- Definition Classes
- FutureThereafter → Thereafter
- See also
https://en.wikipedia.org/wiki/Zipper_(data_structure)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
- def covariantContent[A, B](implicit ev: <:<[A, B]): <:<[Try[A], Try[B]]
Evidences that Content is actually covariant in its type argument.
Evidences that Content is actually covariant in its type argument.
We do not declare Content itself as covariant in the type definition because this would leak into the
Thereafter.Auxpattern and thereby break the compiler's type inference.- Definition Classes
- FutureThereafter → Thereafter
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def executionContext: ExecutionContext
- Definition Classes
- FutureThereafterAsync → ThereafterAsync
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @IntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @IntrinsicCandidate() @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def thereafter[A](f: Future[A])(body: (Content[A]) => Unit): Future[A]
Runs
bodyafter the computationfhas completed.Runs
bodyafter the computationfhas completed.- returns
The computation that results from chaining
fbeforebody. Completes only afterbodyhas run. Ifbodycompletes normally, the result of the computation is the same asf's result. Ifbodythrows, the result includes the thrown exception.
- Definition Classes
- Thereafter
- def thereafterF[A](f: Future[A])(body: (Content[A]) => Future[Unit]): Future[A]
runs
bodyafter the computationfhas completedruns
bodyafter the computationfhas completed- returns
The computation that results from chaining
fbeforebody. Completes only afterbodyhas run. Ifbodycompletes normally, the result of the computation is the same asf's result. Ifbodythrows, the result includes the thrown exception. Ifbodyproduces a failed computation, the result includes the thrown exception.
- Definition Classes
- ThereafterAsync
- def thereafterFSuccessOrFailure[A](f: Future[A])(success: (A) => Future[Unit], failure: => Future[Unit]): Future[A]
- Definition Classes
- ThereafterAsync
- def thereafterP[A](f: Future[A])(body: PartialFunction[Content[A], Unit]): Future[A]
- Definition Classes
- Thereafter
- def thereafterSuccessOrFailure[A](f: Future[A])(success: (A) => Unit, failure: => Unit): Future[A]
- Definition Classes
- Thereafter
- def toString(): String
- Definition Classes
- AnyRef → Any
- def transformChaining[A](f: Future[A])(empty: (Try[Uninhabited]) => Unit, single: (Shape, A) => A): Future[A]
Runs either
emptyorsingleafter the computationfhas run.Runs either
emptyorsingleafter the computationfhas run.- If
fdoes not produce a value of typeA,emptyis run. Ifemptycompletes normally,fis returned. Ifemptythrows, the thrown exception is incorporated intofas follows:- If
fdid not throw an exception, the exception overrides the result off. - If
fdid throw an exception, the exception fromemptyis added as a suppressed exception.
- If
- Otherwise, if
fproduces a single valueaof typeA, then the behavior is equivalent tof.map(single).
This method is more general than thereafter because
singlecan transform the value. This is necessary for instances such as cats.data.Nested where the nested computation must be transformed, which is not possible with thereafter for the outer computation. Note that a plain functor on the outer computation does not suffice because the transformation of the inner computation could throw and it is not guaranteed that the functor properly chains the exceptions. Nested computations are useful for keeping the several computations distinguishable, such as the synchronous and asynchronous parts of message processing.The signature of
singleseparates theShapefrom the value to ensure thatsingleonly transforms the value, but does not change the shape. This is crucial for cats.data.Nested as we would otherwise have to be able to replace the inner computation with an empty content of the outer, which doesn't make sense.- Definition Classes
- FutureThereafter → Thereafter
- If
- def transformChainingF[A](f: Future[A])(empty: (Try[Uninhabited]) => Future[Unit], single: (Unit, A) => Future[A]): Future[A]
- Definition Classes
- FutureThereafterAsync → ThereafterAsync
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withShape[A](shape: Unit, x: A): Try[A]
Plugs the value
xinto the hole of the shape interpreted as a one-hole context.Plugs the value
xinto the hole of the shape interpreted as a one-hole context.- Definition Classes
- FutureThereafter → Thereafter