You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Area-ComputationExpressionsEnd-to-end experience for computation expressions (except async and state machine compilation)BugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.
This script works fine, but when we uncomment the BindReturn member it fails because it seems it doesn't use the Zero method.
type Builder () =
member __.ReturnFrom (expr) = expr : seq<'T>
member inline __.Return (x: 'T) = Seq.singleton x : seq<'T>
member inline __.Yield (x: 'T) = Seq.singleton x : seq<'T>
member inline __.Bind (p: seq<'T>, rest: 'T->seq<'U>) = Seq.collect rest p : seq<'U>
member inline __.Delay (expr: _->seq<'T>) = Seq.delay expr : seq<'T>
member __.Run f = f : seq<'T>
member inline __.Zero () = Seq.empty : seq<'T>
// member inline __.BindReturn (x : seq<'T>, f: 'T -> 'U) : seq<'U> = Seq.map f x
let seqbuilder= new Builder ()
let _pythags = seqbuilder {
let! z = seq [1..50]
let! x = seq [1..z]
let! y = seq [x..z]
if (x*x + y*y = z*z) then return (x, y, z) }
Expected behavior
Compile fine with the BindReturn member
Actual behavior
Doesn't compile with the BindReturn member
Known workarounds
Add an else branch. but still looks like a regression.
@cartermp I guess this isn't totally a regression (or at least not such a severe one), since we don't really expect BindReturn methods to be present unless people are using 5.0. So it's more a bug in the applicatives feature.
I'll fix it now neverthelss but change the priority
@dsyme It's true that it's not 100% a regression, but it hit us. In F#+ we started using it, and it worked fine.
But suddenly, our CIs upgraded to F# 5 and some tests started failing, then we realized that by shipping this optimization we included a breaking change. So we did an emergency release to take it out for the moment.
Area-ComputationExpressionsEnd-to-end experience for computation expressions (except async and state machine compilation)BugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Activity
dsyme commentedon Dec 1, 2020
Yes, this code (with the BindReturn uncommented) compiles with
--langversion:4.7but not--langversion:5.0[-]Possible regression with Applicative CEs[/-][+]Regression with Applicative CEs and 'Zero'[/+]dsyme commentedon Dec 11, 2020
@cartermp I guess this isn't totally a regression (or at least not such a severe one), since we don't really expect
BindReturnmethods to be present unless people are using 5.0. So it's more a bug in the applicatives feature.I'll fix it now neverthelss but change the priority
gusty commentedon Dec 11, 2020
@dsyme It's true that it's not 100% a regression, but it hit us. In F#+ we started using it, and it worked fine.
But suddenly, our CIs upgraded to F# 5 and some tests started failing, then we realized that by shipping this optimization we included a breaking change. So we did an emergency release to take it out for the moment.
gusty commentedon Jun 4, 2021
@dsyme @cartermp Any update on this ?
F# 5 is a thing now.
4 remaining items
[-]Regression with Applicative CEs and 'Zero'[/-][+]Problem with Applicative CEs and 'Zero'[/+]gusty commentedon Sep 6, 2022
@dsyme just curious why did you remove the Regression label?
As per your comments above
Is there any chance this will be fixed anytime soon ? 🤔
T-Gro commentedon Dec 29, 2022
I will check what is needed for a fix.
I might get stuck, so cannot give a promise yet.