sealed trait Outcome[F[_], E, A] extends Product with Serializable
Represents the result of the execution of a fiber. It may terminate in one of 3 states:
- Succeeded(fa) The fiber completed with a value.
A commonly asked question is why this wraps a value of type F[A]
rather than one of type
A
. This is to support monad transformers. Consider
val oc: OutcomeIO[Int] = for { fiber <- Spawn[OptionT[IO, *]].start(OptionT.none[IO, Int]) oc <- fiber.join } yield oc
If the fiber succeeds then there is no value of type Int
to be wrapped in Succeeded
,
hence Succeeded
contains a value of type OptionT[IO, Int]
instead.
In general you can assume that binding on the value of type F[A]
contained in Succeeded
does not perform further effects. In the case of IO
that means that the outcome has been
constructed as Outcome.Succeeded(IO.pure(result))
.
2. Errored(e) The fiber exited with an error.
3. Canceled() The fiber was canceled, either externally or self-canceled via
MonadCancel[F]#canceled
.
- Source
- Outcome.scala
- Alphabetic
- By Inheritance
- Outcome
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
Concrete 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]) @native()
- def embed(onCancel: F[A])(implicit F: MonadCancel[F, E]): F[A]
- def embedError(implicit F: MonadCancel[F, E], ev: <:<[Throwable, E]): F[A]
Allows the restoration to a normal development flow from an Outcome.
Allows the restoration to a normal development flow from an Outcome.
This can be useful for storing the state of a running computation and then waiters for that data can act and continue forward on that shared outcome. Cancelation is encoded as a
CancellationException
. - def embedNever(implicit F: GenSpawn[F, E]): F[A]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def fold[B](canceled: => B, errored: (E) => B, completed: (F[A]) => B): B
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def isCanceled: Boolean
- def isError: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isSuccess: Boolean
- def mapK[G[_]](f: ~>[F, G]): Outcome[G, E, A]
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def productElementName(n: Int): String
- Definition Classes
- Product
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def productIterator: Iterator[Any]
- Definition Classes
- Product
- def productPrefix: String
- Definition Classes
- Product
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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]) @native()