Skip to content

Instantly share code, notes, and snippets.

@Dnomyar
Created September 8, 2020 12:49
Show Gist options
  • Save Dnomyar/214bba7a7464ab8cdab78f651831ab65 to your computer and use it in GitHub Desktop.
Save Dnomyar/214bba7a7464ab8cdab78f651831ab65 to your computer and use it in GitHub Desktop.
ZIO stream from callback
# If you wonder how to create a stream from a callback API, you can use this kind of code (note the forever):
# I guess Task can be replaced by other ZIO constructs
ZStream.fromEffect(
Task.effectAsync[T] { cb =>
cb(Task.succeed(...))
}
).forever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment