Parallel, then I found that I needed Timer, still didn't work. Only after I added CS did it compile
(implicit x: X)to those functions that require par
Hey! I am not sure I understand how
I have multiple concurrent computations which should be started by trigger. Then I need to wait for the completion of all of the computations. I am running multiple fibers and use
Deferred for synchronization. I realized that after calling
Deferred.complete my fibers are processed sequential, but not parallel (as I expected).
I added explicit
Deferred.get in my fiber and now it works in parallel.
Here it is a gist - https://gist.github.com/13h3r2/1923169269db6732170c0058d8a869c1 Pay attention to line 26.
Few questions based on this gist:
Deferredor something else?
import cats.implicits._ import cats.effect.implicits._ val fa: IO[A] val fb: IO[B] val g: (A, B) => C implicit val cs: ContextShift[IO] = ??? // could get via EC val fc: IO[C] = (fa, fb).parMapN(g)
fibers.foldLeft(... _.join)means you will join them in order