Reputation: 31546
With Futures, If I have a list of Futures. I can convert them into a single future by doing Future.sequence
. but on the cats.effect.IO there is no IO.sequence
method.
So if I have a List[IO[Long]]
how do I convert it into IO[List[Long]]
Upvotes: 3
Views: 821
Reputation: 4133
Something like that what are you looking for?:
import cats.instances.list._
import cats.syntax.parallel._
val listIo : List[IO[Long]] = ???
listIo.parSequence
Upvotes: 3