Multiple Invariant[Monoid] instances
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 5.5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
As @floating-cat pointed out here in Gitter, there are currently two Invariant[Monoid] instances in Cats. One is inside the Invariant companion object. Another is the InvariantSemigroupal[Monoid] instance that is located here. In practice, this seems unlikely to cause issues to me (since if you ask for an Invariant[Monoid] the former should "win"). However, it does seem to be an oversight.
If we were to remove the instance from the Invariant companion object, then people would need to start using an import (such as cats.implicits._) to pick up the Invariant[Monoid] instance, which they wouldn't have previously needed to do. Removing it would also be binary incompatible. I'm not sure whether or not it's worth changing this, but if so, I think that we'd have to wait for Cats 3 to make this change.
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.
Research direction
Compare the Invariant companion object with core/src/main/scala/cats/instances/invariant.scala to confirm the duplicate Invariant[Monoid] instances and their resolution behavior. Review the stated import and binary-compatibility concerns; done requires a documented decision about whether this belongs in a future Cats 3 change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100