Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, thanks for this awesome library.
This PR doesn't introduce any new features, just makes existing linq query syntax support complete.
I accidently found the linq query syntax usage from #566.
But the support is incomplete, so I just added the missing implementations (Task/ValueTask/SelectMany etc.),
along with code examples and a brief introduction in the README, so people know this alternative usage exists.
Motivation
Lots of functional languages actually have this syntax sugar, like do-notation in Haskell, for-comprehension in Scala and computation expressions in F#.
C# is not a functional language, but the idea behind the linq syntax is the same, they provide a more concise syntax for the composition of Maybe/Result types without nested function composition or method chaining.
Instead of:
We can use linq query to flatten the code: