B](inputQueue: Queue[Path], reduceQueue: Queue[A], outputQueue: Queue[B], workers: Int) (map: String => A) (z: B)(reduce: (B, A) => B): ZIO[Blocking, Throwable, Unit] = for { mapFibers <- ZIO.collectAll( List.fill(workers)(createMapWorker(inputQueue, reduceQueue)(map)) ) reduceFiber <- for { bRef <- Ref.make(z) fiber <- createReduceWorker(reduceQueue, outputQueue, bRef)(reduce) } yield fiber _ <- Fiber.joinAll(reduceFiber :: mapFibers) } yield () Itamar Ravid - @itrvd 79