Created
September 8, 2020 12:49
-
-
Save Dnomyar/214bba7a7464ab8cdab78f651831ab65 to your computer and use it in GitHub Desktop.
ZIO stream from callback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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