-
Notifications
You must be signed in to change notification settings - Fork 96
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 a function for creating a Task from a value #554
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Why not |
Thanks, the idea is to get some feedback about names first, before merging this. |
I agree that this function should be added, maybe also for ValueTask and Async? I think that @Happypig375 refers to the use of But it feels wrong, 'singleton' suggests that there can also be more. I've seen, in the wild, Task.ret But keep in mind that there was an effort underway where we wanted a very thin library for these super trivial extensions for F#, because these trivial ones seem to be created and exposed in a bunch of libraries, often with different names. The thin lib could be source-embedded. I forgot the most recent state of that discussion, I'll look it up. |
c718153
to
3962979
Compare
I like The problem is, what if in the future we decide to add an Keeping that in mind I still consider |
This PR was already merged my mistake. I'm feeling that Against Is anyone strongly opposed to |
Both |
We normally uses
Task.FromValue
but nowadays, using thetask
CE the namespaceSystem.Threading.Tasks
is not always opened and opening it only to return a task doesn't feel so good.Sometimes what I do is I use
result
but in some places is too generic.Another option is writing
task { return x }
but I think is overkill.Given that we have our Task module in scope with many functions, maybe natural way is to add one there like
List.singleton
does.