NestedStreamOps

fs2.Stream$.NestedStreamOps
final implicit class NestedStreamOps[F[_], O](outer: Stream[F, Stream[F, O]]) extends AnyVal

Provides syntax for streams of streams.

Attributes

Source:
Stream.scala
Graph
Supertypes
class AnyVal
trait Matchable
class Any

Members list

Concise view

Value members

Concrete methods

def 0,was:","").s(maxOpen))else() if(catsSyntaxEq[Int](maxOpen)(catsKernelInstancesForInt).===(1))outer.flatten[[x>:Nothing<:Any]=>F[x],O](refl[Stream[F,O]])else{ valfstream:F[Stream[F,O]]=toFlatMapOps[F,SignallingRef[F,Option[Option[Throwable]]]](SignallingRef.apply[F,Option[Option[Throwable]]](none[Option[Throwable]])(F))(F).flatMap[Stream[F,O]](((done:SignallingRef[F,Option[Option[Throwable]]])=>toFlatMapOps[F,Semaphore[F]](Semaphore.apply[F](maxOpen.toLong)(F))(F).flatMap[Stream[F,O]](((available:Semaphore[F])=>toFlatMapOps[F,SignallingRef[F,Int]](SignallingRef.apply[F,Int](1)(F))(F).flatMap[Stream[F,O]](((running:SignallingRef[F,Int])=>toFlatMapOps[F,Channel[F,F[Unit]]](Channel.unbounded[F,F[Unit]](F))(F).flatMap[Stream[F,O]](((outcomes:Channel[F,F[Unit]])=>toFunctorOps[F,Channel[F,Chunk[O]]](Channel.synchronous[F,Chunk[O]](F))(F).map[Stream[F,O]](((output:Channel[F,Chunk[O]])=>{ defstop(rslt:Option[Throwable]):F[Unit]=done.update(((x$1:Option[Option[Throwable]])=>x$1match{ caserslt0@Some(Some(err0))=> rslt.fold[Option[Option[Throwable]]](rslt0)(((err:Throwable)=>Some.apply[Some[CompositeFailure]](Some.apply[CompositeFailure](CompositeFailure.apply(err0,err,CompositeFailure.apply$default$3))))) case_=> Some.apply[Option[Throwable]](rslt) })) valincrementRunning:F[Unit]=running.update(((_$176:Int)=>_$176.+(1))) valdecrementRunning:F[Unit]=toFlatMapOps[F,Int](running.updateAndGet(((_$177:Int)=>_$177.-(1))))(F).flatMap[Unit](((now:Int)=>if(now.==(0))toFunctorOps[F,Either[Closed,Unit]](outcomes.close)(F).voidelseF.unit)) defonOutcome(oc:Outcome[F,Throwable,Unit],cancelResult:Either[Throwable,Unit]):F[Unit]=ocmatch{ caseOutcome.Succeeded(fu)=> cancelResult.fold[F[Unit]](((t:Throwable)=>stop(Some.apply[Throwable](t))),((_$178:Unit)=>toFunctorOps[F,Either[Closed,Unit]](outcomes.send(fu))(F).void)) caseOutcome.Errored(t)=> CompositeFailure.fromResults(Left.apply[Throwable,Nothing](`t₂`),cancelResult).fold[F[Unit]](((`t₃`:Throwable)=>stop(Some.apply[Throwable](`t₃`))),((_$179:Unit)=>F.unit)) caseOutcome.Canceled()=> cancelResult.fold[F[Unit]](((`t₄`:Throwable)=>stop(Some.apply[Throwable](`t₄`))),((_$180:Unit)=>F.unit)) } defrunInner(inner:Stream[F,O],outerScope:Scope[F]):F[Unit]=F.uncancelable[Unit](((_$181:Poll[F])=>toFlatMapOps[F,Lease[F]](toFlatMapOps[F,Lease[F]](outerScope.lease)(F).flatTap[Unit](((_$182:Lease[F])=>catsSyntaxFlatMapOps[F,Unit](available.acquire)(F).>>[Unit](incrementRunning)(F))))(F).flatMap[Unit](((lease:Lease[F])=>toFunctorOps[F,Fiber[F,Throwable,Unit]](F.start[Unit](catsSyntaxApplicativeErrorFUnit[F,Throwable](monadCancelOps[F,Unit,Throwable](inner.chunks.foreach[[x>:Nothing<:Any]=>F[x]](((s:Chunk[O])=>toFunctorOps[F,Either[Closed,Unit]](output.send(s))(F).void)).interruptWhen[F](SignalOps[F,Option[Option[Throwable]]](done).map[Boolean](((_$183:Option[Option[Throwable]])=>_$183.nonEmpty))(F))(F).compile[[x>:Nothing<:Any]=>F[x],[x>:Nothing<:Any]=>F[x],Any](target[[x>:Nothing<:Any]=>F[x]](forConcurrent[[x>:Nothing<:Any]=>F[x]](F))).drain)(F).guaranteeCase(((`oc₂`:Outcome[F,Throwable,Unit])=>monadCancelOps_[F,Unit](monadCancelOps[F,Unit,Throwable](catsSyntaxMonadErrorRethrow[F,Throwable,Unit](lease.cancel)(F).rethrow(F))(F).guaranteeCase(((`x$1₂`:Outcome[F,Throwable,Unit])=>`x$1₂`match{ caseOutcome.Succeeded(fu)=> onOutcome(catsSyntaxApply[[A>:Nothing<:Any]=>Outcome[F,Throwable,A],Unit](`oc₂`)(applicativeError[F,Throwable](F)).<*[Unit](Outcome.succeeded[F,Throwable,Unit](`fu₂`)),catsSyntaxEitherObject(Either).unit[Throwable]) caseOutcome.Errored(e)=> onOutcome(`oc₂`,catsSyntaxEitherObject(Either).left[Throwable,Nothing](e)) case_=> F.unit }))(F)).forceR[Unit](catsSyntaxFlatMapOps[F,Unit](available.release)(F).>>[Unit](decrementRunning)(F))(F)))(F)).voidError(F)))(F).void)))) defrunOuter:F[Unit]=F.uncancelable[Unit](((_$184:Poll[F])=>catsSyntaxApplicativeErrorFUnit[F,Throwable](monadCancelOps[F,Unit,Throwable](outer.flatMap[[x>:Nothing<:Any]=>F[x],Nothing](((`inner₂`:Stream[F,O])=>StreamPullOps[[x>:Nothing<:Any]=>F[x],Nothing](Pull.getScope[F].flatMap[[x>:Nothing<:Any]=>F[x],Nothing,Unit](((`outerScope₂`:Scope[F])=>Pull.eval[F,Unit](runInner(`inner₂`,`outerScope₂`))))).streamNoScope))(value).drain.interruptWhen[F](SignalOps[F,Option[Option[Throwable]]](done).map[Boolean](((_$185:Option[Option[Throwable]])=>_$185.nonEmpty))(F))(F).compile[[x>:Nothing<:Any]=>F[x],[x>:Nothing<:Any]=>F[x],Any](target[[x>:Nothing<:Any]=>F[x]](forConcurrent[[x>:Nothing<:Any]=>F[x]](F))).drain)(F).guaranteeCase(((_$186:Outcome[F,Throwable,Unit])=>catsSyntaxFlatMapOps[F,Unit](onOutcome(_$186,catsSyntaxEitherObject(Either).unit[Throwable]))(F).>>[Unit](decrementRunning)(F)))(F)).voidError(F))) defoutcomeJoiner:F[Unit]=catsSyntaxApplicativeErrorFUnit[F,Throwable](monadCancelOps[F,Unit,Throwable](outcomes.stream.foreach[[x>:Nothing<:Any]=>F[x]](((x:F[Unit])=>identity[F[Unit]](x))).compile[[x>:Nothing<:Any]=>F[x],[x>:Nothing<:Any]=>F[x],Any](target[[x>:Nothing<:Any]=>F[x]](forConcurrent[[x>:Nothing<:Any]=>F[x]](F))).drain)(F).guaranteeCase(((`x$1₃`:Outcome[F,Throwable,Unit])=>`x$1₃`match{ caseOutcome.Succeeded(_)=> catsSyntaxFlatMapOps[F,Unit](stop(None))(F).>>[Unit](toFunctorOps[F,Either[Closed,Unit]](output.close)(F).void)(F) caseOutcome.Errored(t)=> catsSyntaxFlatMapOps[F,Unit](stop(Some.apply[Throwable](`t₅`)))(F).>>[Unit](toFunctorOps[F,Either[Closed,Unit]](output.close)(F).void)(F) caseOutcome.Canceled()=> catsSyntaxFlatMapOps[F,Unit](stop(None))(F).>>[Unit](toFunctorOps[F,Either[Closed,Unit]](output.close)(F).void)(F) }))(F)).voidError(F) defsignalResult(fiber:Fiber[F,Throwable,Unit]):F[Unit]=toFlatMapOps[F,Option[Option[Throwable]]](done.get)(F).flatMap[Unit](((blah:Option[Option[Throwable]])=>blah.flatten[Throwable](refl[Option[Throwable]]).fold[F[Unit]](fiber.joinWithNever(F))(((`e₂`:Throwable)=>F.raiseError[Unit](`e₂`))))) Stream.bracket[F,Fiber[F,Throwable,Unit]](catsSyntaxFlatMapOps[F,Fiber[F,Throwable,Unit]](F.start[Unit](runOuter))(F).>>[Fiber[F,Throwable,Unit]](F.start[Unit](outcomeJoiner))(F))(((`fiber₂`:Fiber[F,Throwable,Unit])=>catsSyntaxFlatMapOps[F,Unit](catsSyntaxFlatMapOps[F,Unit](stop(None))(F).>>[Unit](running.waitUntil(((_$187:Int)=>_$187.==(0)))(F))(F))(F).>>[Unit](signalResult(`fiber₂`))(F))).flatMap[[x>:Nothing<:Any]=>F[x],O](((_$188:Fiber[F,Throwable,Unit])=>output.stream.flatMap[[x>:Nothing<:Any]=>F[x],O](((os:Chunk[O])=>Stream.chunk[[x>:Nothing<:Any]=>Pure[x],O](os)))(value)))(value) })))))))))) Stream.eval[F,Stream[F,O]](fstream).flatten[[x>:Nothing<:Any]=>F[x],O](refl[Stream[F,O]]) } }" t="n"class="documentableName ">parJoin(maxOpen: Int)(implicit F: Concurrent[F]): Stream[F, O]

Nondeterministically merges a stream of streams (outer) in to a single stream, opening at most maxOpen streams at any point in time.

Nondeterministically merges a stream of streams (outer) in to a single stream, opening at most maxOpen streams at any point in time.

The outer stream is evaluated and each resulting inner stream is run concurrently, up to maxOpen stream. Once this limit is reached, evaluation of the outer stream is paused until one or more inner streams finish evaluating.

When the outer stream stops gracefully, all inner streams continue to run, resulting in a stream that will stop when all inner streams finish their evaluation.

When the outer stream fails, evaluation of all inner streams is interrupted and the resulting stream will fail with same failure.

When any of the inner streams fail, then the outer stream and all other inner streams are interrupted, resulting in stream that fails with the error of the stream that caused initial failure.

Finalizers on each inner stream are run at the end of the inner stream, concurrently with other stream computations.

Finalizers on the outer stream are run after all inner streams have been pulled from the outer stream but not before all inner streams terminate -- hence finalizers on the outer stream will run AFTER the LAST finalizer on the very last inner stream.

Finalizers on the returned stream are run after the outer stream has finished and all open inner streams have finished.

Attributes

maxOpen

Maximum number of open inner streams at any time. Must be > 0.

Source:
Stream.scala
def parJoinUnbounded(implicit F: Concurrent[F]): Stream[F, O]

Like 0,was:","").s(maxOpen))else() if(catsSyntaxEq[Int](maxOpen)(catsKernelInstancesForInt).===(1))outer.flatten[[x>:Nothing<:Any]=>F[x],O](refl[Stream[F,O]])else{ valfstream:F[Stream[F,O]]=toFlatMapOps[F,SignallingRef[F,Option[Option[Throwable]]]](SignallingRef.apply[F,Option[Option[Throwable]]](none[Option[Throwable]])(F))(F).flatMap[Stream[F,O]](((done:SignallingRef[F,Option[Option[Throwable]]])=>toFlatMapOps[F,Semaphore[F]](Semaphore.apply[F](maxOpen.toLong)(F))(F).flatMap[Stream[F,O]](((available:Semaphore[F])=>toFlatMapOps[F,SignallingRef[F,Int]](SignallingRef.apply[F,Int](1)(F))(F).flatMap[Stream[F,O]](((running:SignallingRef[F,Int])=>toFlatMapOps[F,Channel[F,F[Unit]]](Channel.unbounded[F,F[Unit]](F))(F).flatMap[Stream[F,O]](((outcomes:Channel[F,F[Unit]])=>toFunctorOps[F,Channel[F,Chunk[O]]](Channel.synchronous[F,Chunk[O]](F))(F).map[Stream[F,O]](((output:Channel[F,Chunk[O]])=>{ defstop(rslt:Option[Throwable]):F[Unit]=done.update(((x$1:Option[Option[Throwable]])=>x$1match{ caserslt0@Some(Some(err0))=> rslt.fold[Option[Option[Throwable]]](rslt0)(((err:Throwable)=>Some.apply[Some[CompositeFailure]](Some.apply[CompositeFailure](CompositeFailure.apply(err0,err,CompositeFailure.apply$default$3))))) case_=> Some.apply[Option[Throwable]](rslt) })) valincrementRunning:F[Unit]=running.update(((_$176:Int)=>_$176.+(1))) valdecrementRunning:F[Unit]=toFlatMapOps[F,Int](running.updateAndGet(((_$177:Int)=>_$177.-(1))))(F).flatMap[Unit](((now:Int)=>if(now.==(0))toFunctorOps[F,Either[Closed,Unit]](outcomes.close)(F).voidelseF.unit)) defonOutcome(oc:Outcome[F,Throwable,Unit],cancelResult:Either[Throwable,Unit]):F[Unit]=ocmatch{ caseOutcome.Succeeded(fu)=> cancelResult.fold[F[Unit]](((t:Throwable)=>stop(Some.apply[Throwable](t))),((_$178:Unit)=>toFunctorOps[F,Either[Closed,Unit]](outcomes.send(fu))(F).void)) caseOutcome.Errored(t)=> CompositeFailure.fromResults(Left.apply[Throwable,Nothing](`t₂`),cancelResult).fold[F[Unit]](((`t₃`:Throwable)=>stop(Some.apply[Throwable](`t₃`))),((_$179:Unit)=>F.unit)) caseOutcome.Canceled()=> cancelResult.fold[F[Unit]](((`t₄`:Throwable)=>stop(Some.apply[Throwable](`t₄`))),((_$180:Unit)=>F.unit)) } defrunInner(inner:Stream[F,O],outerScope:Scope[F]):F[Unit]=F.uncancelable[Unit](((_$181:Poll[F])=>toFlatMapOps[F,Lease[F]](toFlatMapOps[F,Lease[F]](outerScope.lease)(F).flatTap[Unit](((_$182:Lease[F])=>catsSyntaxFlatMapOps[F,Unit](available.acquire)(F).>>[Unit](incrementRunning)(F))))(F).flatMap[Unit](((lease:Lease[F])=>toFunctorOps[F,Fiber[F,Throwable,Unit]](F.start[Unit](catsSyntaxApplicativeErrorFUnit[F,Throwable](monadCancelOps[F,Unit,Throwable](inner.chunks.foreach[[x>:Nothing<:Any]=>F[x]](((s:Chunk[O])=>toFunctorOps[F,Either[Closed,Unit]](output.send(s))(F).void)).interruptWhen[F](SignalOps[F,Option[Option[Throwable]]](done).map[Boolean](((_$183:Option[Option[Throwable]])=>_$183.nonEmpty))(F))(F).compile[[x>:Nothing<:Any]=>F[x],[x>:Nothing<:Any]=>F[x],Any](target[[x>:Nothing<:Any]=>F[x]](forConcurrent[[x>:Nothing<:Any]=>F[x]](F))).drain)(F).guaranteeCase(((`oc₂`:Outcome[F,Throwable,Unit])=>monadCancelOps_[F,Unit](monadCancelOps[F,Unit,Throwable](catsSyntaxMonadErrorRethrow[F,Throwable,Unit](lease.cancel)(F).rethrow(F))(F).guaranteeCase(((`x$1₂`:Outcome[F,Throwable,Unit])=>`x$1₂`match{ caseOutcome.Succeeded(fu)=> onOutcome(catsSyntaxApply[[A>:Nothing<:Any]=>Outcome[F,Throwable,A],Unit](`oc₂`)(applicativeError[F,Throwable](F)).<*[Unit](Outcome.succeeded[F,Throwable,Unit](`fu₂`)),catsSyntaxEitherObject(Either).unit[Throwable]) caseOutcome.Errored(e)=> onOutcome(`oc₂`,catsSyntaxEitherObject(Either).left[Throwable,Nothing](e)) case_=> F.unit }))(F)).forceR[Unit](catsSyntaxFlatMapOps[F,Unit](available.release)(F).>>[Unit](decrementRunning)(F))(F)))(F)).voidError(F)))(F).void)))) defrunOuter:F[Unit]=F.uncancelable[Unit](((_$184:Poll[F])=>catsSyntaxApplicativeErrorFUnit[F,Throwable](monadCancelOps[F,Unit,Throwable](outer.flatMap[[x>:Nothing<:Any]=>F[x],Nothing](((`inner₂`:Stream[F,O])=>StreamPullOps[[x>:Nothing<:Any]=>F[x],Nothing](Pull.getScope[F].flatMap[[x>:Nothing<:Any]=>F[x],Nothing,Unit](((`outerScope₂`:Scope[F])=>Pull.eval[F,Unit](runInner(`inner₂`,`outerScope₂`))))).streamNoScope))(value).drain.interruptWhen[F](SignalOps[F,Option[Option[Throwable]]](done).map[Boolean](((_$185:Option[Option[Throwable]])=>_$185.nonEmpty))(F))(F).compile[[x>:Nothing<:Any]=>F[x],[x>:Nothing<:Any]=>F[x],Any](target[[x>:Nothing<:Any]=>F[x]](forConcurrent[[x>:Nothing<:Any]=>F[x]](F))).drain)(F).guaranteeCase(((_$186:Outcome[F,Throwable,Unit])=>catsSyntaxFlatMapOps[F,Unit](onOutcome(_$186,catsSyntaxEitherObject(Either).unit[Throwable]))(F).>>[Unit](decrementRunning)(F)))(F)).voidError(F))) defoutcomeJoiner:F[Unit]=catsSyntaxApplicativeErrorFUnit[F,Throwable](monadCancelOps[F,Unit,Throwable](outcomes.stream.foreach[[x>:Nothing<:Any]=>F[x]](((x:F[Unit])=>identity[F[Unit]](x))).compile[[x>:Nothing<:Any]=>F[x],[x>:Nothing<:Any]=>F[x],Any](target[[x>:Nothing<:Any]=>F[x]](forConcurrent[[x>:Nothing<:Any]=>F[x]](F))).drain)(F).guaranteeCase(((`x$1₃`:Outcome[F,Throwable,Unit])=>`x$1₃`match{ caseOutcome.Succeeded(_)=> catsSyntaxFlatMapOps[F,Unit](stop(None))(F).>>[Unit](toFunctorOps[F,Either[Closed,Unit]](output.close)(F).void)(F) caseOutcome.Errored(t)=> catsSyntaxFlatMapOps[F,Unit](stop(Some.apply[Throwable](`t₅`)))(F).>>[Unit](toFunctorOps[F,Either[Closed,Unit]](output.close)(F).void)(F) caseOutcome.Canceled()=> catsSyntaxFlatMapOps[F,Unit](stop(None))(F).>>[Unit](toFunctorOps[F,Either[Closed,Unit]](output.close)(F).void)(F) }))(F)).voidError(F) defsignalResult(fiber:Fiber[F,Throwable,Unit]):F[Unit]=toFlatMapOps[F,Option[Option[Throwable]]](done.get)(F).flatMap[Unit](((blah:Option[Option[Throwable]])=>blah.flatten[Throwable](refl[Option[Throwable]]).fold[F[Unit]](fiber.joinWithNever(F))(((`e₂`:Throwable)=>F.raiseError[Unit](`e₂`))))) Stream.bracket[F,Fiber[F,Throwable,Unit]](catsSyntaxFlatMapOps[F,Fiber[F,Throwable,Unit]](F.start[Unit](runOuter))(F).>>[Fiber[F,Throwable,Unit]](F.start[Unit](outcomeJoiner))(F))(((`fiber₂`:Fiber[F,Throwable,Unit])=>catsSyntaxFlatMapOps[F,Unit](catsSyntaxFlatMapOps[F,Unit](stop(None))(F).>>[Unit](running.waitUntil(((_$187:Int)=>_$187.==(0)))(F))(F))(F).>>[Unit](signalResult(`fiber₂`))(F))).flatMap[[x>:Nothing<:Any]=>F[x],O](((_$188:Fiber[F,Throwable,Unit])=>output.stream.flatMap[[x>:Nothing<:Any]=>F[x],O](((os:Chunk[O])=>Stream.chunk[[x>:Nothing<:Any]=>Pure[x],O](os)))(value)))(value) })))))))))) Stream.eval[F,Stream[F,O]](fstream).flatten[[x>:Nothing<:Any]=>F[x],O](refl[Stream[F,O]]) } }">parJoin but races all inner streams simultaneously.

Like 0,was:","").s(maxOpen))else() if(catsSyntaxEq[Int](maxOpen)(catsKernelInstancesForInt).===(1))outer.flatten[[x>:Nothing<:Any]=>F[x],O](refl[Stream[F,O]])else{ valfstream:F[Stream[F,O]]=toFlatMapOps[F,SignallingRef[F,Option[Option[Throwable]]]](SignallingRef.apply[F,Option[Option[Throwable]]](none[Option[Throwable]])(F))(F).flatMap[Stream[F,O]](((done:SignallingRef[F,Option[Option[Throwable]]])=>toFlatMapOps[F,Semaphore[F]](Semaphore.apply[F](maxOpen.toLong)(F))(F).flatMap[Stream[F,O]](((available:Semaphore[F])=>toFlatMapOps[F,SignallingRef[F,Int]](SignallingRef.apply[F,Int](1)(F))(F).flatMap[Stream[F,O]](((running:SignallingRef[F,Int])=>toFlatMapOps[F,Channel[F,F[Unit]]](Channel.unbounded[F,F[Unit]](F))(F).flatMap[Stream[F,O]](((outcomes:Channel[F,F[Unit]])=>toFunctorOps[F,Channel[F,Chunk[O]]](Channel.synchronous[F,Chunk[O]](F))(F).map[Stream[F,O]](((output:Channel[F,Chunk[O]])=>{ defstop(rslt:Option[Throwable]):F[Unit]=done.update(((x$1:Option[Option[Throwable]])=>x$1match{ caserslt0@Some(Some(err0))=> rslt.fold[Option[Option[Throwable]]](rslt0)(((err:Throwable)=>Some.apply[Some[CompositeFailure]](Some.apply[CompositeFailure](CompositeFailure.apply(err0,err,CompositeFailure.apply$default$3))))) case_=> Some.apply[Option[Throwable]](rslt) })) valincrementRunning:F[Unit]=running.update(((_$176:Int)=>_$176.+(1))) valdecrementRunning:F[Unit]=toFlatMapOps[F,Int](running.updateAndGet(((_$177:Int)=>_$177.-(1))))(F).flatMap[Unit](((now:Int)=>if(now.==(0))toFunctorOps[F,Either[Closed,Unit]](outcomes.close)(F).voidelseF.unit)) defonOutcome(oc:Outcome[F,Throwable,Unit],cancelResult:Either[Throwable,Unit]):F[Unit]=ocmatch{ caseOutcome.Succeeded(fu)=> cancelResult.fold[F[Unit]](((t:Throwable)=>stop(Some.apply[Throwable](t))),((_$178:Unit)=>toFunctorOps[F,Either[Closed,Unit]](outcomes.send(fu))(F).void)) caseOutcome.Errored(t)=> CompositeFailure.fromResults(Left.apply[Throwable,Nothing](`t₂`),cancelResult).fold[F[Unit]](((`t₃`:Throwable)=>stop(Some.apply[Throwable](`t₃`))),((_$179:Unit)=>F.unit)) caseOutcome.Canceled()=> cancelResult.fold[F[Unit]](((`t₄`:Throwable)=>stop(Some.apply[Throwable](`t₄`))),((_$180:Unit)=>F.unit)) } defrunInner(inner:Stream[F,O],outerScope:Scope[F]):F[Unit]=F.uncancelable[Unit](((_$181:Poll[F])=>toFlatMapOps[F,Lease[F]](toFlatMapOps[F,Lease[F]](outerScope.lease)(F).flatTap[Unit](((_$182:Lease[F])=>catsSyntaxFlatMapOps[F,Unit](available.acquire)(F).>>[Unit](incrementRunning)(F))))(F).flatMap[Unit](((lease:Lease[F])=>toFunctorOps[F,Fiber[F,Throwable,Unit]](F.start[Unit](catsSyntaxApplicativeErrorFUnit[F,Throwable](monadCancelOps[F,Unit,Throwable](inner.chunks.foreach[[x>:Nothing<:Any]=>F[x]](((s:Chunk[O])=>toFunctorOps[F,Either[Closed,Unit]](output.send(s))(F).void)).interruptWhen[F](SignalOps[F,Option[Option[Throwable]]](done).map[Boolean](((_$183:Option[Option[Throwable]])=>_$183.nonEmpty))(F))(F).compile[[x>:Nothing<:Any]=>F[x],[x>:Nothing<:Any]=>F[x],Any](target[[x>:Nothing<:Any]=>F[x]](forConcurrent[[x>:Nothing<:Any]=>F[x]](F))).drain)(F).guaranteeCase(((`oc₂`:Outcome[F,Throwable,Unit])=>monadCancelOps_[F,Unit](monadCancelOps[F,Unit,Throwable](catsSyntaxMonadErrorRethrow[F,Throwable,Unit](lease.cancel)(F).rethrow(F))(F).guaranteeCase(((`x$1₂`:Outcome[F,Throwable,Unit])=>`x$1₂`match{ caseOutcome.Succeeded(fu)=> onOutcome(catsSyntaxApply[[A>:Nothing<:Any]=>Outcome[F,Throwable,A],Unit](`oc₂`)(applicativeError[F,Throwable](F)).<*[Unit](Outcome.succeeded[F,Throwable,Unit](`fu₂`)),catsSyntaxEitherObject(Either).unit[Throwable]) caseOutcome.Errored(e)=> onOutcome(`oc₂`,catsSyntaxEitherObject(Either).left[Throwable,Nothing](e)) case_=> F.unit }))(F)).forceR[Unit](catsSyntaxFlatMapOps[F,Unit](available.release)(F).>>[Unit](decrementRunning)(F))(F)))(F)).voidError(F)))(F).void)))) defrunOuter:F[Unit]=F.uncancelable[Unit](((_$184:Poll[F])=>catsSyntaxApplicativeErrorFUnit[F,Throwable](monadCancelOps[F,Unit,Throwable](outer.flatMap[[x>:Nothing<:Any]=>F[x],Nothing](((`inner₂`:Stream[F,O])=>StreamPullOps[[x>:Nothing<:Any]=>F[x],Nothing](Pull.getScope[F].flatMap[[x>:Nothing<:Any]=>F[x],Nothing,Unit](((`outerScope₂`:Scope[F])=>Pull.eval[F,Unit](runInner(`inner₂`,`outerScope₂`))))).streamNoScope))(value).drain.interruptWhen[F](SignalOps[F,Option[Option[Throwable]]](done).map[Boolean](((_$185:Option[Option[Throwable]])=>_$185.nonEmpty))(F))(F).compile[[x>:Nothing<:Any]=>F[x],[x>:Nothing<:Any]=>F[x],Any](target[[x>:Nothing<:Any]=>F[x]](forConcurrent[[x>:Nothing<:Any]=>F[x]](F))).drain)(F).guaranteeCase(((_$186:Outcome[F,Throwable,Unit])=>catsSyntaxFlatMapOps[F,Unit](onOutcome(_$186,catsSyntaxEitherObject(Either).unit[Throwable]))(F).>>[Unit](decrementRunning)(F)))(F)).voidError(F))) defoutcomeJoiner:F[Unit]=catsSyntaxApplicativeErrorFUnit[F,Throwable](monadCancelOps[F,Unit,Throwable](outcomes.stream.foreach[[x>:Nothing<:Any]=>F[x]](((x:F[Unit])=>identity[F[Unit]](x))).compile[[x>:Nothing<:Any]=>F[x],[x>:Nothing<:Any]=>F[x],Any](target[[x>:Nothing<:Any]=>F[x]](forConcurrent[[x>:Nothing<:Any]=>F[x]](F))).drain)(F).guaranteeCase(((`x$1₃`:Outcome[F,Throwable,Unit])=>`x$1₃`match{ caseOutcome.Succeeded(_)=> catsSyntaxFlatMapOps[F,Unit](stop(None))(F).>>[Unit](toFunctorOps[F,Either[Closed,Unit]](output.close)(F).void)(F) caseOutcome.Errored(t)=> catsSyntaxFlatMapOps[F,Unit](stop(Some.apply[Throwable](`t₅`)))(F).>>[Unit](toFunctorOps[F,Either[Closed,Unit]](output.close)(F).void)(F) caseOutcome.Canceled()=> catsSyntaxFlatMapOps[F,Unit](stop(None))(F).>>[Unit](toFunctorOps[F,Either[Closed,Unit]](output.close)(F).void)(F) }))(F)).voidError(F) defsignalResult(fiber:Fiber[F,Throwable,Unit]):F[Unit]=toFlatMapOps[F,Option[Option[Throwable]]](done.get)(F).flatMap[Unit](((blah:Option[Option[Throwable]])=>blah.flatten[Throwable](refl[Option[Throwable]]).fold[F[Unit]](fiber.joinWithNever(F))(((`e₂`:Throwable)=>F.raiseError[Unit](`e₂`))))) Stream.bracket[F,Fiber[F,Throwable,Unit]](catsSyntaxFlatMapOps[F,Fiber[F,Throwable,Unit]](F.start[Unit](runOuter))(F).>>[Fiber[F,Throwable,Unit]](F.start[Unit](outcomeJoiner))(F))(((`fiber₂`:Fiber[F,Throwable,Unit])=>catsSyntaxFlatMapOps[F,Unit](catsSyntaxFlatMapOps[F,Unit](stop(None))(F).>>[Unit](running.waitUntil(((_$187:Int)=>_$187.==(0)))(F))(F))(F).>>[Unit](signalResult(`fiber₂`))(F))).flatMap[[x>:Nothing<:Any]=>F[x],O](((_$188:Fiber[F,Throwable,Unit])=>output.stream.flatMap[[x>:Nothing<:Any]=>F[x],O](((os:Chunk[O])=>Stream.chunk[[x>:Nothing<:Any]=>Pure[x],O](os)))(value)))(value) })))))))))) Stream.eval[F,Stream[F,O]](fstream).flatten[[x>:Nothing<:Any]=>F[x],O](refl[Stream[F,O]]) } }">parJoin but races all inner streams simultaneously.

Attributes

Source:
Stream.scala