typelevel / typelevel/cats

Rename NonEmptySet to NonEmptySortedSet

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

Nobody has claimed this yet.

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

Description

Current implementation of the cats.data.NonEmptySet confuses, because it's not NonEmptySet, it's NonEmptySortedSet.

When it was introduced in cats 1.1.0 I was very excited about it, because there is a lot of use cases in my codebase for the NonEmptySet. But when I tried to use it I noticed that it uses Order typeclass and in general this new NonEmptySet was based on SortedSet, not simple Set. I understand, that there is a lot of use cases for NonEmptySortedSet, but NonEmptySortedSet is not NonEmptySet. For a lot of use cases, I don't need any ordering in my set, I just want to have a set with 1 or more elements.

Сurrent naming is misleading, especially for newcomers. I see no reason why NonEmptySortedSet should be named as NonEmptySet. So, I suggest to rename NonEmptySet to NonEmptySortedSet.

Because this change will break compatibility, I think the best way for renaming should look like this:

  1. Rename NonEmptySortedSet to NonEmptySet.
  2. Create an alias from NonEmptySet to NonEmptySortedSet.
  3. Mark this alias as deprecated.
  4. Remove this alias in the next major release.

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 by locating the cats.data.NonEmptySet implementation and its usages in the repository. Review how the current type is exposed and used, then assess the proposed rename, deprecated alias, and removal in the next major release; done means the compatibility and release steps are defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
data
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.