Open travisbrown opened 4 years ago
I generally disrecommend the standard à la carte imports, so I'm a strong :+1: to not having three ways to do them.
:+1: Let's deprecate. The ops
import is from the original Simulacrum encoding and the nonInheritedOps
was to avoid the loss of syntax from common ancestors when importing multiple. They both predate mixing all syntax enrichments in to a single object (or rather, I was experimenting with an encoding that wouldn't require a Scalaz._
import).
Thanks, @mpilquist—I didn't really have any idea what the original context was, but that makes sense.
Update: now that we've switched to the Scalafix-powered version of Simulacrum (see #3424), we can easily deprecate these definitions, and I personally think we should do this in Cats 2.2.0. If anyone has objections please raise them here.
Cats currently has three ways of importing syntax methods for particular type classes. You can use the subpackage in
syntax
(this is the standard approach to à la carte imports):You could also use the
nonInheritedOps
object in the type class companion, which does exactly the same thing:Or you can use the
ops
object in the companion of any descendant type class:While this last is at least different from the standard
cats.syntax.abc._
approach, and maybe potentially useful, I've never actually seen anyone use it, or recommend it, and it has a serious downside—if you importops._
from multiple type class companions, you lose the syntax methods for the intersection of their ancestors:Or even worse:
…which is probably why nobody uses or recommends these.
So
nonInheritedOps
is redundant, andops
makes it really easy to shoot yourself in the foot. I think we should get rid of both of them in Cats 3, and deprecate them now.These objects are generated by Simulacrum, and I'm not entirely sure it's possible to output deprecated methods using Scala 2's macro annotations (?), but if we move to the Scalafix approach this would be pretty easy.