Skip to content

Commit

Permalink
Make bincompat and prioritization traits package-private (#3003)
Browse files Browse the repository at this point in the history
  • Loading branch information
travisbrown authored and kailuowang committed Aug 23, 2019
1 parent 8c031e5 commit 8bd7283
Show file tree
Hide file tree
Showing 37 changed files with 87 additions and 87 deletions.
4 changes: 2 additions & 2 deletions alleycats-core/src/main/scala/alleycats/Empty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ object Empty extends EmptyInstances0 {
def fromEmptyK[F[_], T](implicit ekf: EmptyK[F]): Empty[F[T]] = ekf.synthesize[T]
}

trait EmptyInstances0 extends compat.IterableEmptyInstance with EmptyInstances1
private[alleycats] trait EmptyInstances0 extends compat.IterableEmptyInstance with EmptyInstances1

trait EmptyInstances1 {
private[alleycats] trait EmptyInstances1 {
// If Monoid extended Empty then this could be an exported subclass instance provided by Monoid
implicit def monoidIsEmpty[A: Monoid]: Empty[A] =
Empty(Monoid[A].empty)
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/scala-2.12-/cats/instances/all.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ trait AllInstances
with UUIDInstances
with VectorInstances

trait AllInstancesBinCompat0 extends FunctionInstancesBinCompat0 with Tuple2InstancesBinCompat0
private[cats] trait AllInstancesBinCompat0 extends FunctionInstancesBinCompat0 with Tuple2InstancesBinCompat0

trait AllInstancesBinCompat1
private[cats] trait AllInstancesBinCompat1
extends OptionInstancesBinCompat0
with ListInstancesBinCompat0
with VectorInstancesBinCompat0
with StreamInstancesBinCompat0
with MapInstancesBinCompat0
with SortedMapInstancesBinCompat0

trait AllInstancesBinCompat2 extends DurationInstances with FiniteDurationInstances
private[cats] trait AllInstancesBinCompat2 extends DurationInstances with FiniteDurationInstances

trait AllInstancesBinCompat3 extends AllCoreDurationInstances
private[cats] trait AllInstancesBinCompat3 extends AllCoreDurationInstances

trait AllInstancesBinCompat4 extends SortedMapInstancesBinCompat1 with MapInstancesBinCompat1
private[cats] trait AllInstancesBinCompat4 extends SortedMapInstancesBinCompat1 with MapInstancesBinCompat1

trait AllInstancesBinCompat5 extends SortedSetInstancesBinCompat0
private[cats] trait AllInstancesBinCompat5 extends SortedSetInstancesBinCompat0
2 changes: 1 addition & 1 deletion core/src/main/scala-2.12-/cats/instances/stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ trait StreamInstances extends cats.kernel.instances.StreamInstances {

}

trait StreamInstancesBinCompat0 {
private[instances] trait StreamInstancesBinCompat0 {
implicit val catsStdTraverseFilterForStream: TraverseFilter[Stream] = new TraverseFilter[Stream] {
val traverse: Traverse[Stream] = cats.instances.stream.catsStdInstancesForStream

Expand Down
12 changes: 6 additions & 6 deletions core/src/main/scala-2.13+/cats/instances/all.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ trait AllInstances
with UUIDInstances
with VectorInstances

trait AllInstancesBinCompat0 extends FunctionInstancesBinCompat0 with Tuple2InstancesBinCompat0
private[cats] trait AllInstancesBinCompat0 extends FunctionInstancesBinCompat0 with Tuple2InstancesBinCompat0

trait AllInstancesBinCompat1
private[cats] trait AllInstancesBinCompat1
extends OptionInstancesBinCompat0
with ListInstancesBinCompat0
with VectorInstancesBinCompat0
with StreamInstancesBinCompat0
with MapInstancesBinCompat0
with SortedMapInstancesBinCompat0

trait AllInstancesBinCompat2 extends DurationInstances with FiniteDurationInstances
private[cats] trait AllInstancesBinCompat2 extends DurationInstances with FiniteDurationInstances

trait AllInstancesBinCompat3 extends AllCoreDurationInstances
private[cats] trait AllInstancesBinCompat3 extends AllCoreDurationInstances

trait AllInstancesBinCompat4 extends SortedMapInstancesBinCompat1 with MapInstancesBinCompat1
private[cats] trait AllInstancesBinCompat4 extends SortedMapInstancesBinCompat1 with MapInstancesBinCompat1

trait AllInstancesBinCompat5 extends SortedSetInstancesBinCompat0
private[cats] trait AllInstancesBinCompat5 extends SortedSetInstancesBinCompat0
2 changes: 1 addition & 1 deletion core/src/main/scala-2.13+/cats/instances/stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ trait StreamInstances extends cats.kernel.instances.StreamInstances {

}

trait StreamInstancesBinCompat0 {
private[instances] trait StreamInstancesBinCompat0 {
@deprecated("2.0.0-RC2", "Use cats.instances.lazyList")
implicit val catsStdTraverseFilterForStream: TraverseFilter[Stream] = new TraverseFilter[Stream] {
val traverse: Traverse[Stream] = cats.instances.stream.catsStdInstancesForStream
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/data/Binested.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ trait BinestedInstances extends BinestedInstances0 {
}
}

trait BinestedInstances0 {
private[data] trait BinestedInstances0 {
implicit def catsDataBifoldableForBinested[F[_, _], G[_], H[_]](
implicit F0: Bifoldable[F],
G0: Foldable[G],
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/instances/function.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import annotation.tailrec

trait FunctionInstances extends cats.kernel.instances.FunctionInstances with Function0Instances with Function1Instances

trait FunctionInstancesBinCompat0 {
private[instances] trait FunctionInstancesBinCompat0 {

/**
* Witness for: E => A <-> E => A
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/instances/list.scala
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ trait ListInstances extends cats.kernel.instances.ListInstances {
}
}

trait ListInstancesBinCompat0 {
private[instances] trait ListInstancesBinCompat0 {
implicit val catsStdTraverseFilterForList: TraverseFilter[List] = new TraverseFilter[List] {
val traverse: Traverse[List] = cats.instances.list.catsStdInstancesForList

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/instances/map.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ trait MapInstances extends cats.kernel.instances.MapInstances {

}

trait MapInstancesBinCompat0 {
private[instances] trait MapInstancesBinCompat0 {

implicit val catsStdComposeForMap: Compose[Map] = new Compose[Map] {

Expand Down Expand Up @@ -139,7 +139,7 @@ trait MapInstancesBinCompat0 {

}

trait MapInstancesBinCompat1 {
private[instances] trait MapInstancesBinCompat1 {
implicit def catsStdMonoidKForMap[K]: MonoidK[Map[K, *]] = new MonoidK[Map[K, *]] {
override def empty[A]: Map[K, A] = Map.empty

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/instances/option.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ trait OptionInstances extends cats.kernel.instances.OptionInstances {
}
}

trait OptionInstancesBinCompat0 {
private[instances] trait OptionInstancesBinCompat0 {
implicit val catsStdTraverseFilterForOption: TraverseFilter[Option] = new TraverseFilter[Option] {
val traverse: Traverse[Option] = cats.instances.option.catsStdInstancesForOption

Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/cats/instances/sortedMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ trait SortedMapInstances extends SortedMapInstances2 {

}

trait SortedMapInstances1 {
private[instances] trait SortedMapInstances1 {
implicit def catsStdEqForSortedMap[K: Order, V: Eq]: Eq[SortedMap[K, V]] =
new SortedMapEq[K, V]
}

trait SortedMapInstances2 extends SortedMapInstances1 {
private[instances] trait SortedMapInstances2 extends SortedMapInstances1 {
implicit def catsStdMonoidForSortedMap[K: Order, V: Semigroup]: Monoid[SortedMap[K, V]] =
new SortedMapMonoid[K, V]
}
Expand Down Expand Up @@ -184,7 +184,7 @@ class SortedMapMonoid[K, V](implicit V: Semigroup[V], O: Order[K]) extends Monoi

}

trait SortedMapInstancesBinCompat0 {
private[instances] trait SortedMapInstancesBinCompat0 {
implicit def catsStdTraverseFilterForSortedMap[K: Order]: TraverseFilter[SortedMap[K, *]] =
new TraverseFilter[SortedMap[K, *]] {

Expand Down Expand Up @@ -224,7 +224,7 @@ trait SortedMapInstancesBinCompat0 {
}
}

trait SortedMapInstancesBinCompat1 {
private[instances] trait SortedMapInstancesBinCompat1 {
implicit def catsStdMonoidKForSortedMap[K: Order]: MonoidK[SortedMap[K, *]] = new MonoidK[SortedMap[K, *]] {
override def empty[A]: SortedMap[K, A] = SortedMap.empty[K, A](Order[K].toOrdering)

Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/instances/sortedSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ trait SortedSetInstances extends SortedSetInstances1 {
new SortedSetOrder[A]
}

trait SortedSetInstances1 {
private[instances] trait SortedSetInstances1 {
implicit def catsKernelStdHashForSortedSet[A: Order: Hash]: Hash[SortedSet[A]] =
new SortedSetHash[A]

implicit def catsKernelStdSemilatticeForSortedSet[A: Order]: BoundedSemilattice[SortedSet[A]] =
new SortedSetSemilattice[A]
}

trait SortedSetInstancesBinCompat0 {
private[instances] trait SortedSetInstancesBinCompat0 {
implicit val catsStdSemigroupalForSortedSet: Semigroupal[SortedSet] = new Semigroupal[SortedSet] {
override def product[A, B](fa: SortedSet[A], fb: SortedSet[B]): SortedSet[(A, B)] = {
implicit val orderingA = fa.ordering
Expand Down
12 changes: 6 additions & 6 deletions core/src/main/scala/cats/instances/tuple.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import scala.annotation.tailrec

trait TupleInstances extends Tuple2Instances with cats.kernel.instances.TupleInstances

trait Tuple2InstancesBinCompat0 {
private[instances] trait Tuple2InstancesBinCompat0 {

/**
* Witness for: (A, A) <-> Boolean => A
Expand All @@ -31,7 +31,7 @@ trait Tuple2InstancesBinCompat0 {
}
}

sealed trait Tuple2Instances extends Tuple2Instances1 {
sealed private[instances] trait Tuple2Instances extends Tuple2Instances1 {
implicit val catsStdBitraverseForTuple2: Bitraverse[Tuple2] =
new Bitraverse[Tuple2] {
def bitraverse[G[_]: Applicative, A, B, C, D](fab: (A, B))(f: A => G[C], g: B => G[D]): G[(C, D)] =
Expand Down Expand Up @@ -103,26 +103,26 @@ sealed trait Tuple2Instances extends Tuple2Instances1 {
}
}

sealed trait Tuple2Instances1 extends Tuple2Instances2 {
sealed private[instances] trait Tuple2Instances1 extends Tuple2Instances2 {
implicit def catsStdCommutativeMonadForTuple2[X](implicit MX: CommutativeMonoid[X]): CommutativeMonad[(X, *)] =
new FlatMapTuple2[X](MX) with CommutativeMonad[(X, *)] {
def pure[A](a: A): (X, A) = (MX.empty, a)
}
}

sealed trait Tuple2Instances2 extends Tuple2Instances3 {
sealed private[instances] trait Tuple2Instances2 extends Tuple2Instances3 {
implicit def catsStdCommutativeFlatMapForTuple2[X](implicit MX: CommutativeSemigroup[X]): CommutativeFlatMap[(X, *)] =
new FlatMapTuple2[X](MX) with CommutativeFlatMap[(X, *)]
}

sealed trait Tuple2Instances3 extends Tuple2Instances4 {
sealed private[instances] trait Tuple2Instances3 extends Tuple2Instances4 {
implicit def catsStdMonadForTuple2[X](implicit MX: Monoid[X]): Monad[(X, *)] =
new FlatMapTuple2[X](MX) with Monad[(X, *)] {
def pure[A](a: A): (X, A) = (MX.empty, a)
}
}

sealed trait Tuple2Instances4 {
sealed private[instances] trait Tuple2Instances4 {
implicit def catsStdFlatMapForTuple2[X](implicit SX: Semigroup[X]): FlatMap[(X, *)] =
new FlatMapTuple2[X](SX)
}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/instances/vector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ trait VectorInstances extends cats.kernel.instances.VectorInstances {
}
}

trait VectorInstancesBinCompat0 {
private[instances] trait VectorInstancesBinCompat0 {
implicit val catsStdTraverseFilterForVector: TraverseFilter[Vector] = new TraverseFilter[Vector] {
val traverse: Traverse[Vector] = cats.instances.vector.catsStdInstancesForVector

Expand Down
16 changes: 8 additions & 8 deletions core/src/main/scala/cats/syntax/all.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cats
package syntax

abstract class AllSyntaxBinCompat
abstract private[cats] class AllSyntaxBinCompat
extends AllSyntax
with AllSyntaxBinCompat0
with AllSyntaxBinCompat1
Expand Down Expand Up @@ -59,9 +59,9 @@ trait AllSyntax
with VectorSyntax
with WriterSyntax

trait AllSyntaxBinCompat0 extends UnorderedTraverseSyntax with ApplicativeErrorExtension with TrySyntax
private[cats] trait AllSyntaxBinCompat0 extends UnorderedTraverseSyntax with ApplicativeErrorExtension with TrySyntax

trait AllSyntaxBinCompat1
private[cats] trait AllSyntaxBinCompat1
extends FlatMapOptionSyntax
with ChoiceSyntax
with NestedSyntax
Expand All @@ -71,17 +71,17 @@ trait AllSyntaxBinCompat1
with ValidatedExtensionSyntax
with RepresentableSyntax

trait AllSyntaxBinCompat2
private[cats] trait AllSyntaxBinCompat2
extends ParallelTraverseSyntax
with TraverseFilterSyntax
with FunctorFilterSyntax
with EitherSyntaxBinCompat0
with ListSyntaxBinCompat0
with ValidatedSyntaxBincompat0

trait AllSyntaxBinCompat3 extends UnorderedFoldableSyntax with Function1Syntax
private[cats] trait AllSyntaxBinCompat3 extends UnorderedFoldableSyntax with Function1Syntax

trait AllSyntaxBinCompat4
private[cats] trait AllSyntaxBinCompat4
extends TraverseFilterSyntaxBinCompat0
with ApplySyntaxBinCompat0
with ParallelApplySyntax
Expand All @@ -90,6 +90,6 @@ trait AllSyntaxBinCompat4
with FoldableSyntaxBinCompat1
with BitraverseSyntaxBinCompat0

trait AllSyntaxBinCompat5 extends ParallelBitraverseSyntax
private[cats] trait AllSyntaxBinCompat5 extends ParallelBitraverseSyntax

trait AllSyntaxBinCompat6 extends ParallelUnorderedTraverseSyntax
private[cats] trait AllSyntaxBinCompat6 extends ParallelUnorderedTraverseSyntax
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/syntax/apply.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait ApplySyntax extends TupleSemigroupalSyntax {
new ApplyOps(fa)
}

trait ApplySyntaxBinCompat0 {
private[syntax] trait ApplySyntaxBinCompat0 {
implicit final def catsSyntaxIfApplyOps[F[_]](fa: F[Boolean]): IfApplyOps[F] =
new IfApplyOps[F](fa)
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/syntax/bitraverse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final class NestedBitraverseOps[F[_, _], G[_], A, B](private val fgagb: F[G[A],
F.bisequence(fgagb)
}

trait BitraverseSyntaxBinCompat0 {
private[syntax] trait BitraverseSyntaxBinCompat0 {
implicit final def catsSyntaxBitraverseBinCompat0[F[_, _]: Bitraverse, A, B](
fab: F[A, B]
): BitraverseOpsBinCompat0[F, A, B] =
Expand All @@ -34,7 +34,7 @@ trait BitraverseSyntaxBinCompat0 {
new LeftNestedBitraverseOps[F, G, A, B](fgab)
}

final class BitraverseOpsBinCompat0[F[_, _], A, B](val fab: F[A, B]) extends AnyVal {
final private[syntax] class BitraverseOpsBinCompat0[F[_, _], A, B](val fab: F[A, B]) extends AnyVal {

/**
* Traverse over the left side of the structure.
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/cats/syntax/either.scala
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,15 @@ final class EitherIdOps[A](private val obj: A) extends AnyVal {

}

trait EitherSyntaxBinCompat0 {
private[syntax] trait EitherSyntaxBinCompat0 {
implicit final def catsSyntaxEitherBinCompat0[A, B](eab: Either[A, B]): EitherOpsBinCompat0[A, B] =
new EitherOpsBinCompat0(eab)

implicit final def catsSyntaxEitherIdBinCompat0[A](a: A): EitherIdOpsBinCompat0[A] =
new EitherIdOpsBinCompat0(a)
}

final class EitherIdOpsBinCompat0[A](private val value: A) extends AnyVal {
final private[syntax] class EitherIdOpsBinCompat0[A](private val value: A) extends AnyVal {

/**
* Wrap a value to a left EitherNec
Expand All @@ -432,7 +432,7 @@ final class EitherIdOpsBinCompat0[A](private val value: A) extends AnyVal {
def rightNec[B]: Either[NonEmptyChain[B], A] = Right(value)
}

final class EitherOpsBinCompat0[A, B](private val value: Either[A, B]) extends AnyVal {
final private[syntax] class EitherOpsBinCompat0[A, B](private val value: Either[A, B]) extends AnyVal {

/** Returns a [[cats.data.ValidatedNec]] representation of this disjunction with the `Left` value
* as a single element on the `Invalid` side of the [[cats.data.NonEmptyList]]. */
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/scala/cats/syntax/foldable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ trait FoldableSyntax extends Foldable.ToFoldableOps with UnorderedFoldable.ToUno
new FoldableOps[F, A](fa)
}

trait FoldableSyntaxBinCompat0 {
private[syntax] trait FoldableSyntaxBinCompat0 {
implicit final def catsSyntaxFoldableOps0[F[_], A](fa: F[A]): FoldableOps0[F, A] =
new FoldableOps0[F, A](fa)
}

trait FoldableSyntaxBinCompat1 {
private[syntax] trait FoldableSyntaxBinCompat1 {
implicit final def catsSyntaxFoldableBinCompat0[F[_]](fa: Foldable[F]): FoldableOps1[F] =
new FoldableOps1(fa)
}
Expand Down Expand Up @@ -305,7 +305,7 @@ final class FoldableOps0[F[_], A](private val fa: F[A]) extends AnyVal {
}
}

final class FoldableOps1[F[_]](private val F: Foldable[F]) extends AnyVal {
final private[syntax] class FoldableOps1[F[_]](private val F: Foldable[F]) extends AnyVal {

/**
* Separate this Foldable into a Tuple by a separating function `A => H[B, C]` for some `Bifoldable[H]`
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/syntax/list.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ final class ListOps[A](private val la: List[A]) extends AnyVal {
}
}

trait ListSyntaxBinCompat0 {
private[syntax] trait ListSyntaxBinCompat0 {
implicit final def catsSyntaxListBinCompat0[A](la: List[A]): ListOpsBinCompat0[A] = new ListOpsBinCompat0(la)
}

final class ListOpsBinCompat0[A](private val la: List[A]) extends AnyVal {
final private[syntax] class ListOpsBinCompat0[A](private val la: List[A]) extends AnyVal {

/**
* Groups elements inside this `List` according to the `Order` of the keys
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/syntax/reducible.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ final class NestedReducibleOps[F[_], G[_], A](private val fga: F[G[A]]) extends
def reduceK(implicit F: Reducible[F], G: SemigroupK[G]): G[A] = F.reduceK(fga)
}

trait ReducibleSyntaxBinCompat0 {
private[syntax] trait ReducibleSyntaxBinCompat0 {
implicit final def catsSyntaxReducibleOps0[F[_], A](fa: F[A]): ReducibleOps0[F, A] =
new ReducibleOps0[F, A](fa)
}
Expand Down
Loading

0 comments on commit 8bd7283

Please sign in to comment.