File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
core/shared/src/main/scala/cats/effect Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -587,7 +587,7 @@ sealed abstract class IO[+A] private () extends IOPlatform[A] {
587587 * [[cede ]] for more details
588588 */
589589 def computeMap [B ](f : A => B ): IO [B ] =
590- IO .cede >> map(f).guarantee( IO .cede )
590+ this .flatMap(a => IO .compute(f(a)) )
591591
592592 /**
593593 * Like [[computeMap ]], but allows raising errors in an Either.
@@ -596,7 +596,7 @@ sealed abstract class IO[+A] private () extends IOPlatform[A] {
596596 * [[computeMap ]] for more details
597597 */
598598 def computeMapAttempt [B ](f : A => Either [Throwable , B ]): IO [B ] =
599- IO .cede >> flatMap(a => IO .fromEither (f(a))).guarantee( IO .cede )
599+ this . flatMap(a => IO .computeAttempt (f(a)))
600600
601601 /**
602602 * Applies rate limiting to this `IO` based on provided backpressure semantics.
@@ -1323,7 +1323,7 @@ object IO extends IOCompanionPlatform with IOLowPriorityImplicits with TuplePara
13231323 * [[compute ]] for more details
13241324 */
13251325 def computeAttempt [A ](thunk : => Either [Throwable , A ]): IO [A ] =
1326- IO .cede >> delay(thunk).rethrow.guarantee(IO .cede)
1326+ IO .cede >> IO . delay(thunk).rethrow.guarantee(IO .cede)
13271327
13281328 /**
13291329 * Suspends a synchronous side effect which produces an `IO` in `IO`.
You can’t perform that action at this time.
0 commit comments