Closed kentcb closed 3 years ago
It doesn't feel hacky to me. It feels explicit.
Yes it feels pretty reasonable to me
@kentcb This is pretty standard with generics when going from F# unit (as 'T) to void in C# where you have this "equivalent" type for the void case in C# but just a single type in F#.
Actually, F#+ has exactly that same Task.Ignore
function, for the same purpose.
Another option is the upcast
operator. I find this nice when implementing interfaces that want a non-generic Task
.
let doesThisWork : System.Threading.Tasks.Task =
upcast task {
do! System.Threading.Tasks.Task.Delay(1000)
}
Thanks all! Glad we're on the right track.
Hello,
Thanks for this useful library.
What is the guidance for working with non-generic
Task
s? A simple repro of my issue:Which produces this error:
One workaround we have is:
And then:
But this feels rather hacky.