New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add StreamMessage.flatMap()
#3966
Labels
Comments
I'll work on this and make a PR when it's ready 😄 |
JFYI, there is a difference in subscription between |
Looking forward to this, @sleeplesslord! 🙇 |
ikhoon
added a commit
that referenced
this issue
Apr 9, 2024
Motivation: `StreamMessage` has `map`, but it is inconvenient to use it when the mapping function itself returns a `StreamMessage`. This PR adds `flatMap` which allows applying a function that returns a `StreamMessage` without ending up with nested `StreamMessage`s. Modifications: - Add `FlatMapStreamMessage`, which uses a function that returns a `StreamMessage` to modify the stream. - Add `StreamMessage.flatMap()` to allow easily creating a `FlatMapStreamMessage` from an existing stream. Result: - Closes #3966 - You can now use `StreamMessage.flatMap` to modify a stream using a function that returns a `StreamMessage`. --------- Co-authored-by: jrhee17 <guins_j@guins.org> Co-authored-by: minwoox <songmw725@gmail.com> Co-authored-by: Ikhun Um <ih.pert@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
StreamMessage
hasmap
which allows mapping the values in a stream with a function. It doesn't currently haveflatMap
so it's difficult to work with a function that itself returns aStreamMessage
, for example when chaining multiple operations.The text was updated successfully, but these errors were encountered: