-
Notifications
You must be signed in to change notification settings - Fork 824
Closed
Labels
Area-ComputationExpressionsEnd-to-end experience for computation expressions (except async and state machine compilation)End-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.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Description
Repro steps
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.
Related information
F# 5.0
Metadata
Metadata
Assignees
Labels
Area-ComputationExpressionsEnd-to-end experience for computation expressions (except async and state machine compilation)End-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.(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Type
Projects
Status
Done