Outcome

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:

  1. 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)).

  1. Errored(e) The fiber exited with an error.

  2. Canceled() The fiber was canceled, either externally or self-canceled via MonadCancel[F]#canceled.

Companion
object
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
class Succeeded[F, E, A]
class Errored[F, E, A]
class Canceled[F, E, A]

Value members

Concrete methods

def embed(onCancel: F[A])(implicit F: MonadCancel[F, E]): F[A]
def embedNever(implicit F: GenSpawn[F, E]): F[A]
def fold[B](canceled: => B, errored: E => B, completed: F[A] => B): B
def isCanceled: Boolean
def isError: Boolean
def isSuccess: Boolean
def mapK[G[_]](f: FunctionK[F, G]): Outcome[G, E, A]

Inherited methods

def canEqual(that: Any): Boolean
Inherited from
Equals
def productArity: Int
Inherited from
Product
def productElement(n: Int): Any
Inherited from
Product
def productElementName(n: Int): String
Inherited from
Product
def productElementNames: Iterator[String]
Inherited from
Product
def productIterator: Iterator[Any]
Inherited from
Product
def productPrefix: String
Inherited from
Product