Skip to content

Bug: TaskSeq.item and tryItem should NOT read past the found item, not even a little bit #65

@abelbraaksma

Description

@abelbraaksma
Member

Consider this:

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.

Activity

abelbraaksma

abelbraaksma commented on Nov 3, 2022

@abelbraaksma
MemberAuthor

Test added in #61.

added a commit that references this issue on Nov 3, 2022
added a commit that references this issue on Nov 3, 2022
added this to the v0.1.0 milestone on Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @abelbraaksma

      Issue actions

        Bug: `TaskSeq.item` and `tryItem` should NOT read past the found item, not even a little bit · Issue #65 · fsprojects/FSharp.Control.TaskSeq