typelevel / typelevel/cats

replicateA_ consistency tests creates very large values

Open
#4,263 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
5.5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
5

Description

Encountered when trying to upgrade fs2 to cats 2.8.0. The Monad[Chunk] and Alternative[Chunk] laws tests fail with out of memory errors. These tests use a Gen[Chunk[Int]] with a max size of 300 elements. The new replicateA_ consistent with replicateA.void test expands that to a 300^4 collection.

https://github.com/typelevel/cats/blob/v2.8.0/laws/src/main/scala/cats/laws/discipline/ApplicativeTests.scala#L63

For now, I'll disable monad + alternative laws testing for Chunk since I don't see a straightforward way to skip that test.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked laws/src/main/scala/cats/laws/discipline/ApplicativeTests.scala at line 63 and inspect how the replicateA_ consistency law is generated. Reproduce the Monad[Chunk] and Alternative[Chunk] law tests and verify the large-value behavior. Done means the relevant Chunk laws run without out-of-memory failures.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.