Search code examples
scalascala-cats

Where to find a cats.NonEmptyParallel[IO,F]?


This used to work:

val ioA = IO(...)
val ioB = IO(...)
val ioC = IO(...)
(ioA, ioB, ioC).parMapN((_, _, _) => ())

Then, about or around Cats 1.0.0-RC2, it stopped working. Now I get

could not find implicit value for parameter p: cats.NonEmptyParallel[cats.effect.IO,F]

and I can't figure out for the life of me what I need to get it working again. Does anybody know what I need to import or pass in (I've tried an implicit Timer[IO]) to get this back up and running? Thanks.


Solution

  • Since RC3, Parallel instance of IO requires a ContextShift[IO] implicit instead of Timer[IO].

    You can get one from IOApp or by doing IO.contextShift(ec), where ec is scala.concurrent.ExecutionContext