How can I avoid returning the task <Microsoft.FSharp.Core.Unit> from the F # library

When transferring an asynchronous operation in F # with Async.StartAsTask, the return type will be Task<unit> . This makes the users of the interface depend on the main F # libraries. Is there any recommended practice to avoid this, or is it generally accepted behavior to leave it as default?

+8
c # clr interop f #
source share
1 answer

You can simply increase the Task<Unit> to Task , since you do not need access to the generic result.

eg.

 let taskOfUnit = asyncOfUnit |> Async.StartAsTask taskOfUnit :> Task 
+9
source share

All Articles