task {
let mutable i = 0
let ts = taskSeq {
i <- i + 1
yield 1
i <- i + 1
yield 2
i <- i + 1 // we should never get here, if we pick idx 1
}
do! ts |> TaskSeq.item 1
printfn "%i" i
}
This prints "3", not "2". That's wrong. Side effects beyond the item found should not execute.
Consider this:
This prints "3", not "2". That's wrong. Side effects beyond the item found should not execute.