rspeele / TaskBuilder.fs

F# computation expression builder for System.Threading.Tasks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using ValueTask instead of Task

nimashoghi opened this issue · comments

Is there any way currently to use ValueTask instead of Task?

What's your objective in doing so?

If it is simply for compatibility with a library that accepts ValueTask<T> as input, you can use the constructor: new ValueTask<_>(task { ... }).

If it is for performance, I am sorry to say that there are so many FSharpFunc objects allocated in the course of running a desugared computation expression that it will not help in the slightest to make the final result a value type.