-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Describe the bug
A function that takes a function as parameter cannot have its result bound with let! or do!, whereas the same works with task just fine.
To Reproduce
let testTR someFunction = taskResult {
let! x = someFunction()
return x
}Expected behavior
No exception, as with task. I.e., the following works:
let testTR someFunction = task {
let! x = someFunction()
return x
}Here, someFunction is inferred to be of unit -> #Task<_>. Similarly, with TaskResult, I'd expect something like unit -> #TaskResult<_, _> to be the top pick.
Desktop (please complete the following information):
- OS: Windows, Linux, MacOS
- Version: any, afaik
Additional context
I realize this request may be considered dubious. After all, TaskResult accepts several concrete types, and if no information is given, which one should be chosen, right?
But the same could be said for task, which accepts task-like, ValueTask and Task/Task<_>.
My guess is that this can be solved by slightly changing the priorities in the overload resolution, but I haven't tried that yet myself. If "impossible", or considered too ambiguous a request, I won't lose sleep over it, promised! :)