From 19a9751c71f0cefa366f447549e51e48cb91d5f6 Mon Sep 17 00:00:00 2001 From: satorg Date: Tue, 31 May 2022 23:26:50 -0700 Subject: [PATCH 1/3] make NonEmptySetImpl --- core/src/main/scala/cats/data/NonEmptySet.scala | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/cats/data/NonEmptySet.scala b/core/src/main/scala/cats/data/NonEmptySet.scala index 6aab86892e..ab601f3558 100644 --- a/core/src/main/scala/cats/data/NonEmptySet.scala +++ b/core/src/main/scala/cats/data/NonEmptySet.scala @@ -25,9 +25,17 @@ package data import cats.kernel._ import scala.collection.immutable._ + import kernel.compat.scalaVersionSpecific._ -private[data] object NonEmptySetImpl extends NonEmptySetInstances with Newtype { +/** + * Actual implementation for [[cats.data.NonEmptySet]] + * + * @note This object is kept public for the sake of binary compatibility only + * and therefore is subject to changes in future versions of Cats. + * Do not use directly - use [[cats.data.NonEmptySet]] instead. + */ +object NonEmptySetImpl extends NonEmptySetInstances with Newtype { private[data] def create[A](s: SortedSet[A]): Type[A] = s.asInstanceOf[Type[A]] @@ -433,7 +441,8 @@ sealed abstract private[data] class NonEmptySetInstances0 extends NonEmptySetIns } sealed abstract private[data] class NonEmptySetInstances1 { - private[data] def catsDataEqForNonEmptySet[A](implicit A: Order[A]): Eq[NonEmptySet[A]] = + @deprecated("use catsDataEqForNonEmptySetFromEqA instead", "2.8.0") + def catsDataEqForNonEmptySet[A](implicit A: Order[A]): Eq[NonEmptySet[A]] = catsDataEqForNonEmptySetFromEqA[A] implicit def catsDataEqForNonEmptySetFromEqA[A](implicit A: Eq[A]): Eq[NonEmptySet[A]] = From c3bb198cf84f6d7b83536c32faef2e0348a2788d Mon Sep 17 00:00:00 2001 From: satorg Date: Wed, 1 Jun 2022 19:48:11 -0700 Subject: [PATCH 2/3] make NonEmptyMapImpl --- core/src/main/scala/cats/data/NonEmptyMapImpl.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/cats/data/NonEmptyMapImpl.scala b/core/src/main/scala/cats/data/NonEmptyMapImpl.scala index dfef97b314..1dc9581d28 100644 --- a/core/src/main/scala/cats/data/NonEmptyMapImpl.scala +++ b/core/src/main/scala/cats/data/NonEmptyMapImpl.scala @@ -26,7 +26,14 @@ import cats.kernel._ import scala.collection.immutable._ -private[data] object NonEmptyMapImpl extends NonEmptyMapInstances with Newtype2 { +/** + * Actual implementation for [[cats.data.NonEmptyMap]] + * + * @note This object is kept public for the sake of binary compatibility only + * and therefore is subject to changes in future versions of Cats. + * Do not use directly - use [[cats.data.NonEmptyMap]] instead. + */ +object NonEmptyMapImpl extends NonEmptyMapInstances with Newtype2 { private[data] def create[K, A](m: SortedMap[K, A]): Type[K, A] = m.asInstanceOf[Type[K, A]] From d6fb9df047ed8dc2bc5c61de35aebd9645b47023 Mon Sep 17 00:00:00 2001 From: satorg Date: Wed, 1 Jun 2022 20:06:12 -0700 Subject: [PATCH 3/3] make NonEmptyChainImpl --- core/src/main/scala/cats/data/NonEmptyChain.scala | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/core/src/main/scala/cats/data/NonEmptyChain.scala b/core/src/main/scala/cats/data/NonEmptyChain.scala index 86a7db7bef..d2f1968fe1 100644 --- a/core/src/main/scala/cats/data/NonEmptyChain.scala +++ b/core/src/main/scala/cats/data/NonEmptyChain.scala @@ -22,14 +22,19 @@ package cats package data -import NonEmptyChainImpl.create - import cats.instances.StaticMethods import cats.kernel._ import scala.collection.immutable.SortedMap -private[data] object NonEmptyChainImpl extends NonEmptyChainInstances with ScalaVersionSpecificNonEmptyChainImpl { +/** + * Actual implementation for [[cats.data.NonEmptyChain]] + * + * @note This object is kept public for the sake of binary compatibility only + * and therefore is subject to changes in future versions of Cats. + * Do not use directly - use [[cats.data.NonEmptyChain]] instead. + */ +object NonEmptyChainImpl extends NonEmptyChainInstances with ScalaVersionSpecificNonEmptyChainImpl { // The following 3 types are components of a technique to // create a no-boxing newtype. It's copied from the // newtypes lib by @alexknvl @@ -83,10 +88,12 @@ class NonEmptyChainOps[A](private val value: NonEmptyChain[A]) extends AnyVal with NonEmptyCollection[A, Chain, NonEmptyChain] { + import NonEmptyChainImpl.{create, unwrap} + /** * Converts this chain to a `Chain` */ - final def toChain: Chain[A] = NonEmptyChainImpl.unwrap(value) + final def toChain: Chain[A] = unwrap(value) /** * Returns a new NonEmptyChain consisting of `a` followed by this. O(1) runtime.