Search code examples
iomonadsscala-cats

cats-effect: How to transform `List[IO[A]]` to `IO[List[A]]`


I have an List[IO[A]] and I want to convert it to an IO[List[A]] In scalaz I would use sequenceU but I don't find the equivalent in cats


Solution

  • This solved my problems

    import cats.implicits._
    
    val x: List[IO[A]] = ...
    val y: IO[List[A]] = x.sequence