Issue with plain Task and do!
garuma opened this issue · comments
Jérémie Laval commented
Works:
let fooTask = FSharp.Control.Tasks.ContextSensitive.task
let someOp =
fooTask {
do! Task.Delay(4)
}
Doesn't work:
let fooTask = FSharp.Control.Tasks.ContextInsensitive.task
let someOp =
fooTask {
do! Task.Delay(4)
}
With the following errors:
error FS0001: The type 'Task' is not compatible with the type 'Task<'a>'
error FS0193: Type constraint mismatch. The type 'Task' is not compatible with type 'Task<unit>'
Basically the insensitive builder seem to not have the generic support for awaitable that's in the code
Robert Peele commented
It should work if you open FSharp.Control.Tasks.ContextInsensitive
.
The generic awaitable is not defined on the builder class, but on an extension method exported by that module. So you must open the module to use generic awaitables; just bringing in builder object itself is not enough.