I'm trying to compose ZIO.fromFuture
with ZStream.async
following this example but I have a type issue:
ZIO.fromFuture
gives me Task[+A] = ZIO[Any, Throwable, A]
but Zstream.emit
needs ZIO[R, Option[E], Chunk[A]]
[
How could I turn a Future into a ZStream if that makes sense?
val t: ZIO[Any, Throwable, Chunk[A]] = ZIO.fromFuture(_ => Future[A])
val stream = ZStream.async[Any, Throwable, A] { cb =>
cb(t)
None
}