-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decide how public-facing instance traits should be #3008
Comments
Just as a data point, I've used those in third-party code so that I could make one combined import for cats implicits + my library implicits + another library implicits, to help reduce brain effort on imports |
As another random data point… I originally structured djspiewak/shims to hide the "All" traits, so the only way to actually get at anything was via the |
But this is only relevant for syntax now, isn't it? |
Yes, which significantly decreases (though does not entirely remove) the relevancy of interaction with prioritization. |
Right now we have
AllInstances
andAllSyntax
traits that are in the public API and are sometimes used outside of Cats itself—for example in Circe we have aCirceSuite
helper class that extends these traits so that we don't have to importcats.implicits._
in every test file.The problem with this kind of usage is that
AllInstances
andAllSyntax
don't actually include all of anything, ever since we started stacking onBinCompatN
layers to maintain binary compatibility on Scala 2.11. For example, want aDefer
forFunction0
? You won't get it fromAllInstances
—you also needAllInstancesBinCompat0
.This means anyone using
AllInstances
orAllSyntax
has to be careful to add the latestAllSyntaxBinCompat37
or whatever traits included in each new Cats release if they actually want everything.This is something we haven't managed to stay on track on even within Cats itself—e.g. see #3007, which is due to the fact that
cats.implicits
is lagging twoAllSyntaxBinCompat
s behind, orSyntaxSuite
, which is fourAllInstanceBinCompat
s out of date (but happens to still be working), etc.To make things even more confusing, there's a
AllSyntaxBinCompat
(note the missing number) abstract class that bundles up all the syntax bin-compat traits, but no equivalentAllInstancesBinCompat
.I've also recently proposed (and merged) making the bin-compat traits package-private (#3003), which on second thoughts I think we'll have to undo, at least until 2.1.
So there's a lot of miscellaneous little brokenness and inconsistency and mildly bad UX here, some of which I'm about to open a PR to address, but there's also a bigger question of whether we actually intend the
AllInstances
andAllSyntax
traits to be used outside of the implementation of Cats itself.The text was updated successfully, but these errors were encountered: