Skip to content

Array.difference possibly attempting multiple iterations over array iterators #5812

@dpnova

Description

@dpnova

What version of Effect is running?

3.19.6

What steps can reproduce the bug?

Play repro here https://effect.website/play#7289872c6a03

The contains check in difference with would be iterating the same iterator multiple times.

What is the expected behavior?

That the resulting difference arrays would be the same if they were stable arrays - see play example.

What do you see instead?

Different resulting arrays when using iterators with more than a non-trivial number of elements

Additional information

I'm heading away to NZ for a week otherwise this would be a PR. Happy to do it when I get back if no one has picked it up by then.

Possible fix

A cheap fix may be to change the types and make sure arrays are passed. Not sure if that's acceptable though given the rest of array is quite iterable-positive,

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions