typelevel / typelevel/cats

Aliasing `cats.kernel.Order` in `cats._` package leads to ambiguous reference error

Open
#1,182 1 comment 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

Im using cats.kernel.Comparison, which isn't aliased and so requires import cats.kernel. I generally have a wildcard import policy for cats packages, which leads to:

reference to Order is ambiguous;
[error] it is imported twice in the same scope by
[error] import cats.kernel._
[error] and import cats._

IMO, there are two sustainable options:

  • Policy to alias the entire public API of cats.kernel._ into cats._. Implies PRs etc aren't complete until the alias is added.
  • Don't alias anything. People have to import both explicitly to work with cats.

There is a third option, which is people are supposed to cherrypick-import non-ambiguous names from kernel as needed, but IMO thats a minefield we should avoid creating in the first place.

(apologies if I missed earlier discussion of this issue, I struggle to keep up with everything cats. please cross-link any prior context)

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 reviewing the cats.kernel and cats._ public import surfaces, especially the handling of Order and Comparison, then look for earlier discussion of the two proposed aliasing policies. Done requires an agreed policy and a clearly scoped implementation plan; the issue does not identify files or tests to change.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.