Skip to content
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

It is not possible to create an Option<Task>. #99

Open
NathanMagnus opened this issue Jun 25, 2020 · 4 comments
Open

It is not possible to create an Option<Task>. #99

NathanMagnus opened this issue Jun 25, 2020 · 4 comments
Milestone

Comments

@NathanMagnus
Copy link
Contributor

NathanMagnus commented Jun 25, 2020

It is not possible to create an Option<Task<T>> using .Some.

Both Option.Some(Task<T>) and Option.SomeAsync(Task<T>) produce Task<Option<T>>.

@NathanMagnus
Copy link
Contributor Author

It appears to be possible using Option.FromNullable(Task) but this not an honest use of the method when the input is known to not be null.

@RyanMarcotte
Copy link
Collaborator

I would like to understand the use case better here... What can be accomplished (or made easier by) using Option<Task<T>> that can't with Task<Option<T>>?

@NathanMagnus
Copy link
Contributor Author

In hindsight, possibly nothing.

It seems a little more accurate when referencing an async call that might not have happened, but doesn't necessarily offer any direct advantages.

@JohannesMoersch
Copy link
Owner

The problem actually has to do with backward compatibility. There's a Some method that's obsolete that accepts a Task<>. This was from before I introduced the explicit Async methods. Not sure how I can solve this.

@JohannesMoersch JohannesMoersch added this to the Function 3 milestone Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants