Search code examples
scalascala-catsfs2

How to convert a Stream[IO, List[A]] to Stream[IO, A]


I want to parse a json file which output a collection of A. The signature of the Output is IO[List[A]]

How can I convert this value to a Stream: Stream[IO, A] ? I can convert to a Stream[IO, List[A]] but it is not what I want

fs2.Stream.eval(input).flatMap(x => fs2.Stream.apply(x)) Thanks


Solution

  • Try

    fs2.Stream.eval(output).flatMap(x => fs2.Stream.apply(x: _*))
    

    What does `:_*` (colon underscore star) do in Scala?