Skip to content

Commit 1a9d53c

Browse files
committed
EffectSystem: Zio Effects
1 parent 7fb67d8 commit 1a9d53c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

modules/core/src/main/scala/com/flowforge/core/EffectSystem.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ trait EffectSystem[F[_]] {
246246
*/
247247
def onError[A](fa: F[A])(pf: PartialFunction[Throwable, F[Unit]]): F[A] =
248248
handleErrorWith(fa)(e =>
249-
flatMap(if (pf.isDefinedAt(e)) pf(e) else pure(()))((_ => raiseError(e))))
249+
flatMap(if (pf.isDefinedAt(e)) pf(e) else pure(()))(_ => raiseError(e)))
250250

251251
// ===============================
252252
// SYNC OPERATIONS
@@ -324,8 +324,8 @@ trait EffectSystem[F[_]] {
324324
*/
325325
def race[A, B](fa: F[A], fb: F[B]): F[Either[A, B]] =
326326
flatMap(racePair(fa, fb)) {
327-
case Left((a, fiberB)) => map(fiberB.cancel)((_ => Left(a)))
328-
case Right((fiberA, b)) => map(fiberA.cancel)((_ => Right(b)))
327+
case Left((a, fiberB)) => map(fiberB.cancel)(_ => Left(a))
328+
case Right((fiberA, b)) => map(fiberA.cancel)(_ => Right(b))
329329
}
330330

331331
// ===============================
@@ -772,15 +772,14 @@ object EffectSystem {
772772
* enabling a fluent API that feels natural in Scala.
773773
*
774774
* Usage:
775-
* ```scala
775+
*
776776
* import EffectSystemOps._
777777
*
778778
* val result = for {
779779
* a <- effect1
780780
* b <- effect2.handleError(recover)
781781
* c <- effect3.timeout(30.seconds)
782782
* } yield (a, b, c)
783-
* ```
784783
*/
785784
implicit class EffectSystemOps[F[_], A](fa: F[A])(implicit F: EffectSystem[F]) {
786785
def map[B](f: A => B): F[B] = F.map(fa)(f)

0 commit comments

Comments
 (0)