Typeclass instances for `ZipLazyList` and `ZipStream` seem to be unlawful
@satorg is already working on this.
Since Mar 3, 2026.
- Dominant language
- Scala
- Stars
- 5.5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
There are Alternative and CommutativeApplicative instances for both ZipLazyList and ZipStream:
However, the corresponding laws have never been verified. The existing tests for both ZipLazyList and ZipStream check laws only up to CommutativeApply, with the following comment:
Can't test applicative laws as they don't terminate
Moreover, ZipList, ZipVector, ZipSeq, as well as their *NonEmpty* counterparts, define instances only up to CommutativeApply.
Taken together, this strongly suggests that ZipLazyList and ZipStream cannot lawfully provide anything stronger than CommutativeApply.
Perhaps the Alternative and CommutativeApplicative instances for ZipLazyList and ZipStream should be moved to alleycats-core, while cats-core should retain only CommutativeApply.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.