Skip to content

Commit

Permalink
Add two new combinators: cedeMap and intercede
Browse files Browse the repository at this point in the history
  • Loading branch information
biuld committed Jan 11, 2023
1 parent 9b2ba64 commit ed15013
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,10 @@ final class GenSpawnOps[F[_], A, E] private[syntax] (private val wrapped: F[A])
implicit F: GenSpawn[F, E]
): F[(Outcome[F, E, A], Outcome[F, E, B])] =
F.bothOutcome(wrapped, another)

def cedeMap[B](f: A => B)(implicit F: GenSpawn[F, E]): F[B] =
F.cedeMap(wrapped)(f)

def intercede(implicit F: GenSpawn[F, E]): F[A] =
F.intercede(wrapped)
}
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ class SyntaxSpec extends Specification {
val result = target.bothOutcome(another)
result: F[(Outcome[F, E, A], Outcome[F, E, B])]
}

{
val result = target.intercede
result: F[A]
}
}

def spawnForwarder[F[_]: Spawn] =
Expand Down

0 comments on commit ed15013

Please sign in to comment.