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] {
587
587
* [[cede ]] for more details
588
588
*/
589
589
def computeMap [B ](f : A => B ): IO [B ] =
590
- IO .cede >> map(f).guarantee( IO .cede )
590
+ this .flatMap(a => IO .compute(f(a)) )
591
591
592
592
/**
593
593
* Like [[computeMap ]], but allows raising errors in an Either.
@@ -596,7 +596,7 @@ sealed abstract class IO[+A] private () extends IOPlatform[A] {
596
596
* [[computeMap ]] for more details
597
597
*/
598
598
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)))
600
600
601
601
/**
602
602
* Applies rate limiting to this `IO` based on provided backpressure semantics.
@@ -1323,7 +1323,7 @@ object IO extends IOCompanionPlatform with IOLowPriorityImplicits with TuplePara
1323
1323
* [[compute ]] for more details
1324
1324
*/
1325
1325
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)
1327
1327
1328
1328
/**
1329
1329
* Suspends a synchronous side effect which produces an `IO` in `IO`.
You can’t perform that action at this time.
0 commit comments