I've been moving some code from Taskbuilder.fs to Ply and I've noticed an odd compilation error.
It seems that when the type of an expression unwrapped with let! is unspecified, it is always inferred as Ply<'t>.
Naturally, if I'm not using the uply builder, that's unlikely to be the default that I want, especially since it's an "unsafe" builder.
I'm much more likely to be composing the same kind of CE all the way through. But then I get a compile error at the call site because the let! expects a Ply<_> unless explicitly annotated.
Would it be possible to make each builder choose its own type as the default inference target for let! and other unwrappings?
Minimal repro
open FSharp.Control.Tasks
let higherOrderTask t = task {
let! result = t()
return result + "_1"
}
let someTask () = System.IO.File.ReadAllTextAsync("/somePath")
let instance = higherOrderTask someTask
(* someTask: Type mismatch. Expecting a
'unit -> Ply.Ply<string>'
but given a
'unit -> Task<string>'
*)
Current workaround:
let! result = (t() : Task<_>)
I've been moving some code from Taskbuilder.fs to Ply and I've noticed an odd compilation error.
It seems that when the type of an expression unwrapped with
let!is unspecified, it is always inferred asPly<'t>.Naturally, if I'm not using the
uplybuilder, that's unlikely to be the default that I want, especially since it's an "unsafe" builder.I'm much more likely to be composing the same kind of CE all the way through. But then I get a compile error at the call site because the
let!expects aPly<_>unless explicitly annotated.Would it be possible to make each builder choose its own type as the default inference target for
let!and other unwrappings?Minimal repro
Current workaround: