Skip to content

Commit

Permalink
Merge pull request #4111 from satorg/fix-outcome-docs
Browse files Browse the repository at this point in the history
fixes and attempts to improve scaladoc for Outcome
  • Loading branch information
djspiewak committed Aug 1, 2024
2 parents 4775a3b + 9fce81f commit caee0e8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions kernel/shared/src/main/scala/cats/effect/kernel/Outcome.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,23 @@ import scala.util.{Either, Left, Right}
* `A`. This is to support monad transformers. Consider
*
* {{{
* val oc: OutcomeIO[Int] =
* val oc: OptionT[IO, Outcome[OptionT[IO, *], Throwable, 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.
* hence `Succeeded` contains a value of type `OptionT[IO, Int]` instead:
*
* {{{
* def run: IO[Unit] =
* for {
* res <- oc.flatMap(_.embedNever).value // `res` is `Option[Int]` here
* _ <- Console[IO].println(res) // prints "None"
* } yield ()
* }}}
*
* 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
Expand Down

0 comments on commit caee0e8

Please sign in to comment.