diff --git a/binCompatTest/src/main/scala/catsBC/MimaExceptions.scala b/binCompatTest/src/main/scala/catsBC/MimaExceptions.scala index 8e8473fd7d..3777168f18 100644 --- a/binCompatTest/src/main/scala/catsBC/MimaExceptions.scala +++ b/binCompatTest/src/main/scala/catsBC/MimaExceptions.scala @@ -20,7 +20,9 @@ object MimaExceptions { cats.data.OptionT.catsDataMonadErrorMonadForOptionT[List], FunctionK.lift(headOption), "blah".leftNec[Int], - List(Some(4), None).nested + List(Some(4), None).nested, + cats.data.EitherT.left[Int](Option("err")), + true.iterateUntilM(Option(_))(identity _) ) } diff --git a/build.sbt b/build.sbt index 6adf2f4fb9..80b3d2bff0 100644 --- a/build.sbt +++ b/build.sbt @@ -280,11 +280,92 @@ def mimaSettings(moduleName: String) = exclude[DirectMissingMethodProblem]("cats.data.KleisliInstances1.catsDataCommutativeArrowForKleisli"), exclude[DirectMissingMethodProblem]("cats.data.KleisliInstances4.catsDataCommutativeFlatMapForKleisli"), exclude[DirectMissingMethodProblem]("cats.data.IRWSTInstances1.catsDataStrongForIRWST"), - exclude[DirectMissingMethodProblem]("cats.data.OptionTInstances1.catsDataMonadErrorMonadForOptionT"), - //These 2 things are `.value` on a Ops class (which shouldn't have ever been exposed) - See #2514 and #2613. - exclude[DirectMissingMethodProblem]("cats.syntax.EitherIdOpsBinCompat0.value"), - exclude[DirectMissingMethodProblem]("cats.syntax.NestedIdOps.value") - ) ++ // Only compile-time abstractions (macros) allowed here + exclude[DirectMissingMethodProblem]("cats.data.OptionTInstances1.catsDataMonadErrorMonadForOptionT") + ) ++ + //These things are Ops classes that shouldn't have the `value` exposed. These should have never been public because they don't + //provide any value. Making them private because of issues like #2514 and #2613. + Seq( + exclude[DirectMissingMethodProblem]("cats.ApplicativeError#LiftFromOptionPartially.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.Const#OfPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.EitherT#CondPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.EitherT#FromEitherPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.EitherT#FromOptionPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.EitherT#LeftPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.EitherT#LeftTPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.EitherT#PurePartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.EitherT#RightPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.IorT#BothTPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.IorT#CondPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.IorT#FromEitherPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.IorT#FromIorPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.IorT#FromOptionPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.IorT#LeftPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.IorT#LeftTPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.IorT#PurePartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.IorT#RightPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.NonEmptyChainOps.value"), + exclude[DirectMissingMethodProblem]("cats.data.OptionT#FromOptionPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.OptionT#PurePartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.data.Validated#CatchOnlyPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.free.Free#FreeInjectKPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.free.Free#FreeLiftInjectKPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.free.FreeT#FreeTLiftInjectKPartiallyApplied.dummy"), + exclude[DirectMissingMethodProblem]("cats.syntax.ApplicativeErrorIdOps.e"), + exclude[DirectMissingMethodProblem]("cats.syntax.ApplicativeErrorOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.ApplicativeIdOps.a"), + exclude[DirectMissingMethodProblem]("cats.syntax.ApplicativeOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.ApplyOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.BinestedIdOps.value"), + exclude[DirectMissingMethodProblem]("cats.syntax.BitraverseOps.fab"), + exclude[DirectMissingMethodProblem]("cats.syntax.DistributiveOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.EitherIdOps.obj"), + exclude[DirectMissingMethodProblem]("cats.syntax.EitherIdOpsBinCompat0.value"), + exclude[DirectMissingMethodProblem]("cats.syntax.EitherKOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.EitherObjectOps.either"), + exclude[DirectMissingMethodProblem]("cats.syntax.EitherOps.eab"), + exclude[DirectMissingMethodProblem]("cats.syntax.EitherOpsBinCompat0.value"), + exclude[DirectMissingMethodProblem]("cats.syntax.FlatMapIdOps.a"), + exclude[DirectMissingMethodProblem]("cats.syntax.FlatMapOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.FlatMapOptionOps.fopta"), + exclude[DirectMissingMethodProblem]("cats.syntax.FlattenOps.ffa"), + exclude[DirectMissingMethodProblem]("cats.syntax.FoldableOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.GuardOps.condition"), + exclude[DirectMissingMethodProblem]("cats.syntax.IfMOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.IndexOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.IorIdOps.a"), + exclude[DirectMissingMethodProblem]("cats.syntax.LeftOps.left"), + exclude[DirectMissingMethodProblem]("cats.syntax.ListOps.la"), + exclude[DirectMissingMethodProblem]("cats.syntax.ListOpsBinCompat0.la"), + exclude[DirectMissingMethodProblem]("cats.syntax.MonadErrorOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.MonadErrorRethrowOps.fea"), + exclude[DirectMissingMethodProblem]("cats.syntax.MonadIdOps.a"), + exclude[DirectMissingMethodProblem]("cats.syntax.MonadOps.fa"), + exclude[DirectMissingMethodProblem]("cats.syntax.MonoidOps.lhs"), + exclude[DirectMissingMethodProblem]("cats.syntax.NestedBitraverseOps.fgagb"), + exclude[DirectMissingMethodProblem]("cats.syntax.NestedFoldableOps.fga"), + exclude[DirectMissingMethodProblem]("cats.syntax.NestedIdOps.value"), + exclude[DirectMissingMethodProblem]("cats.syntax.NestedReducibleOps.fga"), + exclude[DirectMissingMethodProblem]("cats.syntax.OptionIdOps.a"), + exclude[DirectMissingMethodProblem]("cats.syntax.OptionOps.oa"), + exclude[DirectMissingMethodProblem]("cats.syntax.ParallelApOps.ma"), + exclude[DirectMissingMethodProblem]("cats.syntax.ParallelFlatSequenceOps.tmta"), + exclude[DirectMissingMethodProblem]("cats.syntax.ParallelFlatTraversableOps.ta"), + exclude[DirectMissingMethodProblem]("cats.syntax.ParallelSequence_Ops.tma"), + exclude[DirectMissingMethodProblem]("cats.syntax.ParallelSequenceOps.tma"), + exclude[DirectMissingMethodProblem]("cats.syntax.ParallelTraversable_Ops.ta"), + exclude[DirectMissingMethodProblem]("cats.syntax.ParallelTraversableOps.ta"), + exclude[DirectMissingMethodProblem]("cats.syntax.RightOps.right"), + exclude[DirectMissingMethodProblem]("cats.syntax.SeparateOps.fgab"), + exclude[DirectMissingMethodProblem]("cats.syntax.SetOps.se"), + exclude[DirectMissingMethodProblem]("cats.syntax.TabulateOps.f"), + exclude[DirectMissingMethodProblem]("cats.syntax.TryOps.self"), + exclude[DirectMissingMethodProblem]("cats.syntax.UniteOps.fga"), + exclude[DirectMissingMethodProblem]("cats.syntax.ValidatedExtension.self"), + exclude[DirectMissingMethodProblem]("cats.syntax.ValidatedIdOpsBinCompat0.a"), + exclude[DirectMissingMethodProblem]("cats.syntax.ValidatedIdSyntax.a"), + exclude[DirectMissingMethodProblem]("cats.syntax.VectorOps.va"), + exclude[DirectMissingMethodProblem]("cats.syntax.WriterIdSyntax.a") + ) ++ // Only compile-time abstractions (macros) allowed here Seq( exclude[IncompatibleMethTypeProblem]("cats.arrow.FunctionKMacros.lift"), exclude[MissingTypesProblem]("cats.arrow.FunctionKMacros$"), diff --git a/core/src/main/scala/cats/ApplicativeError.scala b/core/src/main/scala/cats/ApplicativeError.scala index 8c8cd7566e..ca83230a95 100644 --- a/core/src/main/scala/cats/ApplicativeError.scala +++ b/core/src/main/scala/cats/ApplicativeError.scala @@ -183,7 +183,7 @@ trait ApplicativeError[F[_], E] extends Applicative[F] { object ApplicativeError { def apply[F[_], E](implicit F: ApplicativeError[F, E]): ApplicativeError[F, E] = F - final private[cats] class LiftFromOptionPartially[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[cats] class LiftFromOptionPartially[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[E, A](oa: Option[A], ifEmpty: => E)(implicit F: ApplicativeError[F, _ >: E]): F[A] = oa match { case Some(a) => F.pure(a) diff --git a/core/src/main/scala/cats/data/Const.scala b/core/src/main/scala/cats/data/Const.scala index 107e0352dc..944091286e 100644 --- a/core/src/main/scala/cats/data/Const.scala +++ b/core/src/main/scala/cats/data/Const.scala @@ -42,7 +42,7 @@ object Const extends ConstInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class OfPartiallyApplied[B](val dummy: Boolean = true) extends AnyVal { + final private[data] class OfPartiallyApplied[B](private val dummy: Boolean = true) extends AnyVal { def apply[A](a: A): Const[A, B] = Const(a) } diff --git a/core/src/main/scala/cats/data/EitherT.scala b/core/src/main/scala/cats/data/EitherT.scala index 2dbe0e989d..a17e6ab7c9 100644 --- a/core/src/main/scala/cats/data/EitherT.scala +++ b/core/src/main/scala/cats/data/EitherT.scala @@ -306,7 +306,7 @@ object EitherT extends EitherTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class LeftPartiallyApplied[B](val dummy: Boolean = true) extends AnyVal { + final private[data] class LeftPartiallyApplied[B](private val dummy: Boolean = true) extends AnyVal { def apply[F[_], A](fa: F[A])(implicit F: Functor[F]): EitherT[F, A, B] = EitherT(F.map(fa)(Either.left)) } @@ -324,7 +324,7 @@ object EitherT extends EitherTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class LeftTPartiallyApplied[F[_], B](val dummy: Boolean = true) extends AnyVal { + final private[data] class LeftTPartiallyApplied[F[_], B](private val dummy: Boolean = true) extends AnyVal { def apply[A](a: A)(implicit F: Applicative[F]): EitherT[F, A, B] = EitherT(F.pure(Either.left(a))) } @@ -342,7 +342,7 @@ object EitherT extends EitherTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class RightPartiallyApplied[A](val dummy: Boolean = true) extends AnyVal { + final private[data] class RightPartiallyApplied[A](private val dummy: Boolean = true) extends AnyVal { def apply[F[_], B](fb: F[B])(implicit F: Functor[F]): EitherT[F, A, B] = EitherT(F.map(fb)(Either.right)) } @@ -360,7 +360,7 @@ object EitherT extends EitherTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class PurePartiallyApplied[F[_], A](val dummy: Boolean = true) extends AnyVal { + final private[data] class PurePartiallyApplied[F[_], A](private val dummy: Boolean = true) extends AnyVal { def apply[B](b: B)(implicit F: Applicative[F]): EitherT[F, A, B] = right(F.pure(b)) } @@ -435,7 +435,7 @@ object EitherT extends EitherTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class FromEitherPartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class FromEitherPartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[E, A](either: Either[E, A])(implicit F: Applicative[F]): EitherT[F, E, A] = EitherT(F.pure(either)) } @@ -456,7 +456,7 @@ object EitherT extends EitherTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class FromOptionPartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class FromOptionPartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[E, A](opt: Option[A], ifNone: => E)(implicit F: Applicative[F]): EitherT[F, E, A] = EitherT(F.pure(Either.fromOption(opt, ifNone))) } @@ -494,7 +494,7 @@ object EitherT extends EitherTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class CondPartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class CondPartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[E, A](test: Boolean, right: => A, left: => E)(implicit F: Applicative[F]): EitherT[F, E, A] = EitherT(F.pure(Either.cond(test, right, left))) } diff --git a/core/src/main/scala/cats/data/IorT.scala b/core/src/main/scala/cats/data/IorT.scala index bc0b14f854..aa1db952fc 100644 --- a/core/src/main/scala/cats/data/IorT.scala +++ b/core/src/main/scala/cats/data/IorT.scala @@ -130,7 +130,7 @@ object IorT extends IorTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class LeftPartiallyApplied[B](val dummy: Boolean = true) extends AnyVal { + final private[data] class LeftPartiallyApplied[B](private val dummy: Boolean = true) extends AnyVal { def apply[F[_], A](fa: F[A])(implicit F: Functor[F]): IorT[F, A, B] = IorT(F.map(fa)(Ior.left)) } @@ -148,7 +148,7 @@ object IorT extends IorTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class LeftTPartiallyApplied[F[_], B](val dummy: Boolean = true) extends AnyVal { + final private[data] class LeftTPartiallyApplied[F[_], B](private val dummy: Boolean = true) extends AnyVal { def apply[A](a: A)(implicit F: Applicative[F]): IorT[F, A, B] = IorT(F.pure(Ior.left(a))) } @@ -167,7 +167,7 @@ object IorT extends IorTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class RightPartiallyApplied[A](val dummy: Boolean = true) extends AnyVal { + final private[data] class RightPartiallyApplied[A](private val dummy: Boolean = true) extends AnyVal { def apply[F[_], B](fb: F[B])(implicit F: Functor[F]): IorT[F, A, B] = IorT(F.map(fb)(Ior.right)) } @@ -208,7 +208,7 @@ object IorT extends IorTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class BothTPartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class BothTPartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[A, B](a: A, b: B)(implicit F: Applicative[F]): IorT[F, A, B] = IorT(F.pure(Ior.Both(a, b))) } @@ -226,7 +226,7 @@ object IorT extends IorTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class PurePartiallyApplied[F[_], A](val dummy: Boolean = true) extends AnyVal { + final private[data] class PurePartiallyApplied[F[_], A](private val dummy: Boolean = true) extends AnyVal { def apply[B](b: B)(implicit F: Applicative[F]): IorT[F, A, B] = IorT(F.pure(Ior.right(b))) } @@ -274,7 +274,7 @@ object IorT extends IorTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class FromIorPartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class FromIorPartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[A, B](ior: Ior[A, B])(implicit F: Applicative[F]): IorT[F, A, B] = IorT(F.pure(ior)) } @@ -293,7 +293,7 @@ object IorT extends IorTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class FromEitherPartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class FromEitherPartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[E, A](either: Either[E, A])(implicit F: Applicative[F]): IorT[F, E, A] = IorT(F.pure(either.toIor)) } @@ -325,7 +325,7 @@ object IorT extends IorTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class FromOptionPartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class FromOptionPartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[E, A](option: Option[A], ifNone: => E)(implicit F: Applicative[F]): IorT[F, E, A] = IorT(F.pure(option.toRightIor(ifNone))) } @@ -363,7 +363,7 @@ object IorT extends IorTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class CondPartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class CondPartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[A, B](test: Boolean, right: => B, left: => A)(implicit F: Applicative[F]): IorT[F, A, B] = IorT(F.pure(if (test) Ior.right(right) else Ior.left(left))) } diff --git a/core/src/main/scala/cats/data/NonEmptyChain.scala b/core/src/main/scala/cats/data/NonEmptyChain.scala index ba55ce7907..9aad230469 100644 --- a/core/src/main/scala/cats/data/NonEmptyChain.scala +++ b/core/src/main/scala/cats/data/NonEmptyChain.scala @@ -68,7 +68,7 @@ private[data] object NonEmptyChainImpl extends NonEmptyChainInstances { new NonEmptyChainOps(value) } -class NonEmptyChainOps[A](val value: NonEmptyChain[A]) extends AnyVal { +class NonEmptyChainOps[A](private val value: NonEmptyChain[A]) extends AnyVal { /** * Converts this chain to a `Chain` diff --git a/core/src/main/scala/cats/data/OptionT.scala b/core/src/main/scala/cats/data/OptionT.scala index 1b5b19c84d..7b96cec97e 100644 --- a/core/src/main/scala/cats/data/OptionT.scala +++ b/core/src/main/scala/cats/data/OptionT.scala @@ -156,7 +156,7 @@ object OptionT extends OptionTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class PurePartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class PurePartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[A](value: A)(implicit F: Applicative[F]): OptionT[F, A] = OptionT(F.pure(Some(value))) } @@ -201,7 +201,7 @@ object OptionT extends OptionTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class FromOptionPartiallyApplied[F[_]](val dummy: Boolean = true) extends AnyVal { + final private[data] class FromOptionPartiallyApplied[F[_]](private val dummy: Boolean = true) extends AnyVal { def apply[A](value: Option[A])(implicit F: Applicative[F]): OptionT[F, A] = OptionT(F.pure(value)) } diff --git a/core/src/main/scala/cats/data/Validated.scala b/core/src/main/scala/cats/data/Validated.scala index 862878a32b..f2016b47a4 100644 --- a/core/src/main/scala/cats/data/Validated.scala +++ b/core/src/main/scala/cats/data/Validated.scala @@ -346,7 +346,7 @@ object Validated extends ValidatedInstances with ValidatedFunctions with Validat /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[data] class CatchOnlyPartiallyApplied[T](val dummy: Boolean = true) extends AnyVal { + final private[data] class CatchOnlyPartiallyApplied[T](private val dummy: Boolean = true) extends AnyVal { def apply[A](f: => A)(implicit T: ClassTag[T], NT: NotNull[T]): Validated[T, A] = try { valid(f) diff --git a/core/src/main/scala/cats/syntax/DistributiveSyntax.scala b/core/src/main/scala/cats/syntax/DistributiveSyntax.scala index 25b67b2cc0..a5ae364e38 100644 --- a/core/src/main/scala/cats/syntax/DistributiveSyntax.scala +++ b/core/src/main/scala/cats/syntax/DistributiveSyntax.scala @@ -9,7 +9,7 @@ trait DistributiveSyntax extends Distributive.ToDistributiveOps { } // Add syntax to functor as part of importing distributive syntax. -final class DistributiveOps[F[_], A](val fa: F[A]) extends AnyVal { +final class DistributiveOps[F[_], A](private val fa: F[A]) extends AnyVal { def distribute[G[_], B](f: A => G[B])(implicit G: Distributive[G], F: Functor[F]): G[F[B]] = G.distribute(fa)(f) def cosequence[G[_], B](implicit G: Distributive[G], F: Functor[F], ev: A === G[B]): G[F[B]] = G.cosequence(ev.substitute(fa)) diff --git a/core/src/main/scala/cats/syntax/TrySyntax.scala b/core/src/main/scala/cats/syntax/TrySyntax.scala index efde5b2c13..bfc7394018 100644 --- a/core/src/main/scala/cats/syntax/TrySyntax.scala +++ b/core/src/main/scala/cats/syntax/TrySyntax.scala @@ -7,7 +7,7 @@ trait TrySyntax { implicit final def catsSyntaxTry[A](t: Try[A]): TryOps[A] = new TryOps(t) } -final class TryOps[A](val self: Try[A]) extends AnyVal { +final class TryOps[A](private val self: Try[A]) extends AnyVal { /** * lift the `try` into a `F[_]` with `ApplicativeError[F, Throwable]` instance diff --git a/core/src/main/scala/cats/syntax/alternative.scala b/core/src/main/scala/cats/syntax/alternative.scala index 04e241e357..a387b71fc4 100644 --- a/core/src/main/scala/cats/syntax/alternative.scala +++ b/core/src/main/scala/cats/syntax/alternative.scala @@ -13,7 +13,7 @@ trait AlternativeSyntax { new GuardOps(b) } -final class UniteOps[F[_], G[_], A](val fga: F[G[A]]) extends AnyVal { +final class UniteOps[F[_], G[_], A](private val fga: F[G[A]]) extends AnyVal { /** * @see [[Alternative.unite]] @@ -32,7 +32,7 @@ final class UniteOps[F[_], G[_], A](val fga: F[G[A]]) extends AnyVal { G: Foldable[G]): F[A] = A.unite[G, A](fga) } -final class SeparateOps[F[_], G[_, _], A, B](val fgab: F[G[A, B]]) extends AnyVal { +final class SeparateOps[F[_], G[_, _], A, B](private val fgab: F[G[A, B]]) extends AnyVal { /** * @see [[Alternative.separate]] @@ -51,7 +51,7 @@ final class SeparateOps[F[_], G[_, _], A, B](val fgab: F[G[A, B]]) extends AnyVa G: Bifoldable[G]): (F[A], F[B]) = A.separate[G, A, B](fgab) } -final class GuardOps(val condition: Boolean) extends AnyVal { +final class GuardOps(private val condition: Boolean) extends AnyVal { /** * @see [[Alternative.guard]] diff --git a/core/src/main/scala/cats/syntax/applicative.scala b/core/src/main/scala/cats/syntax/applicative.scala index 53e92664b7..4e2a271b02 100644 --- a/core/src/main/scala/cats/syntax/applicative.scala +++ b/core/src/main/scala/cats/syntax/applicative.scala @@ -8,11 +8,11 @@ trait ApplicativeSyntax { new ApplicativeOps[F, A](fa) } -final class ApplicativeIdOps[A](val a: A) extends AnyVal { +final class ApplicativeIdOps[A](private val a: A) extends AnyVal { def pure[F[_]](implicit F: Applicative[F]): F[A] = F.pure(a) } -final class ApplicativeOps[F[_], A](val fa: F[A]) extends AnyVal { +final class ApplicativeOps[F[_], A](private val fa: F[A]) extends AnyVal { def replicateA(n: Int)(implicit F: Applicative[F]): F[List[A]] = F.replicateA(n, fa) def unlessA(cond: Boolean)(implicit F: Applicative[F]): F[Unit] = F.unlessA(cond)(fa) def whenA(cond: Boolean)(implicit F: Applicative[F]): F[Unit] = F.whenA(cond)(fa) diff --git a/core/src/main/scala/cats/syntax/applicativeError.scala b/core/src/main/scala/cats/syntax/applicativeError.scala index ab039b3c92..2f379ad151 100644 --- a/core/src/main/scala/cats/syntax/applicativeError.scala +++ b/core/src/main/scala/cats/syntax/applicativeError.scala @@ -68,12 +68,12 @@ final class ApplicativeErrorExtensionOps[F[_], E](F: ApplicativeError[F, E]) { } -final class ApplicativeErrorIdOps[E](val e: E) extends AnyVal { +final class ApplicativeErrorIdOps[E](private val e: E) extends AnyVal { def raiseError[F[_], A](implicit F: ApplicativeError[F, _ >: E]): F[A] = F.raiseError(e) } -final class ApplicativeErrorOps[F[_], E, A](val fa: F[A]) extends AnyVal { +final class ApplicativeErrorOps[F[_], E, A](private val fa: F[A]) extends AnyVal { def handleError(f: E => A)(implicit F: ApplicativeError[F, E]): F[A] = F.handleError(fa)(f) diff --git a/core/src/main/scala/cats/syntax/apply.scala b/core/src/main/scala/cats/syntax/apply.scala index 9a5999e3a0..cb62157098 100644 --- a/core/src/main/scala/cats/syntax/apply.scala +++ b/core/src/main/scala/cats/syntax/apply.scala @@ -14,7 +14,7 @@ trait ApplySyntax extends TupleSemigroupalSyntax { new ApplyOps(fa) } -final class ApplyOps[F[_], A](val fa: F[A]) extends AnyVal { +final class ApplyOps[F[_], A](private val fa: F[A]) extends AnyVal { /** Alias for [[Apply.productR]]. */ @deprecated("Use *> or productR instead.", "1.0.0-RC2") diff --git a/core/src/main/scala/cats/syntax/binested.scala b/core/src/main/scala/cats/syntax/binested.scala index eeb07527db..2963a59ba0 100644 --- a/core/src/main/scala/cats/syntax/binested.scala +++ b/core/src/main/scala/cats/syntax/binested.scala @@ -10,6 +10,6 @@ trait BinestedSyntax { new BinestedIdOps(value) } -final class BinestedIdOps[F[_, _], G[_], H[_], A, B](val value: F[G[A], H[B]]) extends AnyVal { +final class BinestedIdOps[F[_, _], G[_], H[_], A, B](private val value: F[G[A], H[B]]) extends AnyVal { def binested: Binested[F, G, H, A, B] = Binested(value) } diff --git a/core/src/main/scala/cats/syntax/bitraverse.scala b/core/src/main/scala/cats/syntax/bitraverse.scala index 35fe883313..a21b474c50 100644 --- a/core/src/main/scala/cats/syntax/bitraverse.scala +++ b/core/src/main/scala/cats/syntax/bitraverse.scala @@ -13,12 +13,12 @@ private[syntax] trait BitraverseSyntax1 { new NestedBitraverseOps[F, G, A, B](fgagb) } -final class BitraverseOps[F[_, _], A, B](val fab: F[A, B]) extends AnyVal { +final class BitraverseOps[F[_, _], A, B](private val fab: F[A, B]) extends AnyVal { def bitraverse[G[_]: Applicative, C, D](f: A => G[C], g: B => G[D])(implicit F: Bitraverse[F]): G[F[C, D]] = F.bitraverse(fab)(f, g) } -final class NestedBitraverseOps[F[_, _], G[_], A, B](val fgagb: F[G[A], G[B]]) extends AnyVal { +final class NestedBitraverseOps[F[_, _], G[_], A, B](private val fgagb: F[G[A], G[B]]) extends AnyVal { def bisequence(implicit F: Bitraverse[F], G: Applicative[G]): G[F[A, B]] = F.bisequence(fgagb) } diff --git a/core/src/main/scala/cats/syntax/either.scala b/core/src/main/scala/cats/syntax/either.scala index 916db248bb..9b4c92f834 100644 --- a/core/src/main/scala/cats/syntax/either.scala +++ b/core/src/main/scala/cats/syntax/either.scala @@ -36,7 +36,7 @@ object EitherSyntax { } } -final class EitherOps[A, B](val eab: Either[A, B]) extends AnyVal { +final class EitherOps[A, B](private val eab: Either[A, B]) extends AnyVal { def foreach(f: B => Unit): Unit = eab match { case Left(_) => () case Right(b) => f(b) @@ -293,7 +293,7 @@ final class EitherOps[A, B](val eab: Either[A, B]) extends AnyVal { def liftTo[F[_]](implicit F: ApplicativeError[F, _ >: A]): F[B] = F.fromEither(eab) } -final class EitherObjectOps(val either: Either.type) extends AnyVal { // scalastyle:off ensure.single.space.after.token +final class EitherObjectOps(private val either: Either.type) extends AnyVal { // scalastyle:off ensure.single.space.after.token def left[A, B](a: A): Either[A, B] = Left(a) def right[A, B](b: B): Either[A, B] = Right(b) @@ -350,19 +350,19 @@ final class EitherObjectOps(val either: Either.type) extends AnyVal { // scalast } } -final class LeftOps[A, B](val left: Left[A, B]) extends AnyVal { +final class LeftOps[A, B](private val left: Left[A, B]) extends AnyVal { /** Cast the right type parameter of the `Left`. */ def rightCast[C]: Either[A, C] = left.asInstanceOf[Either[A, C]] } -final class RightOps[A, B](val right: Right[A, B]) extends AnyVal { +final class RightOps[A, B](private val right: Right[A, B]) extends AnyVal { /** Cast the left type parameter of the `Right`. */ def leftCast[C]: Either[C, B] = right.asInstanceOf[Either[C, B]] } -final class EitherIdOps[A](val obj: A) extends AnyVal { +final class EitherIdOps[A](private val obj: A) extends AnyVal { /** Wrap a value in `Left`. */ def asLeft[B]: Either[A, B] = Left(obj) @@ -431,7 +431,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](val value: Either[A, B]) extends AnyVal { +final 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]]. */ diff --git a/core/src/main/scala/cats/syntax/eitherK.scala b/core/src/main/scala/cats/syntax/eitherK.scala index d9f3f0ecb8..0e0983cdda 100644 --- a/core/src/main/scala/cats/syntax/eitherK.scala +++ b/core/src/main/scala/cats/syntax/eitherK.scala @@ -7,7 +7,7 @@ trait EitherKSyntax { implicit final def catsSyntaxEitherK[F[_], A](a: F[A]): EitherKOps[F, A] = new EitherKOps(a) } -final class EitherKOps[F[_], A](val fa: F[A]) extends AnyVal { +final class EitherKOps[F[_], A](private val fa: F[A]) extends AnyVal { /** * Lift an `F[A]` into a `EitherK[F, G, A]` for any type constructor `G[_]`. diff --git a/core/src/main/scala/cats/syntax/flatMap.scala b/core/src/main/scala/cats/syntax/flatMap.scala index 7669874917..7cf0e24daf 100644 --- a/core/src/main/scala/cats/syntax/flatMap.scala +++ b/core/src/main/scala/cats/syntax/flatMap.scala @@ -16,7 +16,7 @@ trait FlatMapSyntax extends FlatMap.ToFlatMapOps { new FlatMapOps[F, A](fa) } -final class FlatMapOps[F[_], A](val fa: F[A]) extends AnyVal { +final class FlatMapOps[F[_], A](private val fa: F[A]) extends AnyVal { /** * Alias for [[flatMap]]. @@ -63,7 +63,7 @@ final class FlatMapOps[F[_], A](val fa: F[A]) extends AnyVal { } -final class FlattenOps[F[_], A](val ffa: F[F[A]]) extends AnyVal { +final class FlattenOps[F[_], A](private val ffa: F[F[A]]) extends AnyVal { /** * Flatten nested `F` values. @@ -80,7 +80,7 @@ final class FlattenOps[F[_], A](val ffa: F[F[A]]) extends AnyVal { def flatten(implicit F: FlatMap[F]): F[A] = F.flatten(ffa) } -final class IfMOps[F[_]](val fa: F[Boolean]) extends AnyVal { +final class IfMOps[F[_]](private val fa: F[Boolean]) extends AnyVal { /** * A conditional lifted into the `F` context. @@ -104,7 +104,7 @@ final class IfMOps[F[_]](val fa: F[Boolean]) extends AnyVal { def ifM[B](ifTrue: => F[B], ifFalse: => F[B])(implicit F: FlatMap[F]): F[B] = F.ifM(fa)(ifTrue, ifFalse) } -final class FlatMapIdOps[A](val a: A) extends AnyVal { +final class FlatMapIdOps[A](private val a: A) extends AnyVal { /** * Example: @@ -135,7 +135,7 @@ trait FlatMapOptionSyntax { new FlatMapOptionOps[F, A](foa) } -final class FlatMapOptionOps[F[_], A](val fopta: F[Option[A]]) extends AnyVal { +final class FlatMapOptionOps[F[_], A](private val fopta: F[Option[A]]) extends AnyVal { /** * This repeats an F until we get defined values. This can be useful diff --git a/core/src/main/scala/cats/syntax/foldable.scala b/core/src/main/scala/cats/syntax/foldable.scala index 5a618662df..2df8423847 100644 --- a/core/src/main/scala/cats/syntax/foldable.scala +++ b/core/src/main/scala/cats/syntax/foldable.scala @@ -9,7 +9,7 @@ trait FoldableSyntax extends Foldable.ToFoldableOps with UnorderedFoldable.ToUno new FoldableOps[F, A](fa) } -final class NestedFoldableOps[F[_], G[_], A](val fga: F[G[A]]) extends AnyVal { +final class NestedFoldableOps[F[_], G[_], A](private val fga: F[G[A]]) extends AnyVal { def sequence_(implicit F: Foldable[F], G: Applicative[G]): G[Unit] = F.sequence_(fga) /** @@ -27,7 +27,7 @@ final class NestedFoldableOps[F[_], G[_], A](val fga: F[G[A]]) extends AnyVal { def foldK(implicit F: Foldable[F], G: MonoidK[G]): G[A] = F.foldK(fga) } -final class FoldableOps[F[_], A](val fa: F[A]) extends AnyVal { +final class FoldableOps[F[_], A](private val fa: F[A]) extends AnyVal { def foldl[B](b: B)(f: (B, A) => B)(implicit F: Foldable[F]): B = F.foldLeft(fa, b)(f) diff --git a/core/src/main/scala/cats/syntax/ior.scala b/core/src/main/scala/cats/syntax/ior.scala index 73e1d467c6..80a870341d 100644 --- a/core/src/main/scala/cats/syntax/ior.scala +++ b/core/src/main/scala/cats/syntax/ior.scala @@ -6,7 +6,7 @@ trait IorSyntax { implicit final def catsSyntaxIorId[A](a: A): IorIdOps[A] = new IorIdOps(a) } -final class IorIdOps[A](val a: A) extends AnyVal { +final class IorIdOps[A](private val a: A) extends AnyVal { /** * Wrap a value in `Ior.Right`. diff --git a/core/src/main/scala/cats/syntax/list.scala b/core/src/main/scala/cats/syntax/list.scala index 0c2221bcd3..9ee915d21f 100644 --- a/core/src/main/scala/cats/syntax/list.scala +++ b/core/src/main/scala/cats/syntax/list.scala @@ -8,7 +8,7 @@ trait ListSyntax { implicit final def catsSyntaxList[A](la: List[A]): ListOps[A] = new ListOps(la) } -final class ListOps[A](val la: List[A]) extends AnyVal { +final class ListOps[A](private val la: List[A]) extends AnyVal { /** * Returns an Option of NonEmptyList from a List @@ -54,7 +54,7 @@ trait ListSyntaxBinCompat0 { implicit final def catsSyntaxListBinCompat0[A](la: List[A]): ListOpsBinCompat0[A] = new ListOpsBinCompat0(la) } -final class ListOpsBinCompat0[A](val la: List[A]) extends AnyVal { +final class ListOpsBinCompat0[A](private val la: List[A]) extends AnyVal { /** * Groups elements inside this `List` according to the `Order` of the keys diff --git a/core/src/main/scala/cats/syntax/monad.scala b/core/src/main/scala/cats/syntax/monad.scala index 224fc52c13..b048827e73 100644 --- a/core/src/main/scala/cats/syntax/monad.scala +++ b/core/src/main/scala/cats/syntax/monad.scala @@ -8,7 +8,7 @@ trait MonadSyntax { new MonadIdOps[A](a) } -final class MonadOps[F[_], A](val fa: F[A]) extends AnyVal { +final class MonadOps[F[_], A](private val fa: F[A]) extends AnyVal { def whileM[G[_]](p: F[Boolean])(implicit M: Monad[F], G: Alternative[G]): F[G[A]] = M.whileM(p)(fa) def whileM_(p: F[Boolean])(implicit M: Monad[F]): F[Unit] = M.whileM_(p)(fa) def untilM[G[_]](p: F[Boolean])(implicit M: Monad[F], G: Alternative[G]): F[G[A]] = M.untilM(fa)(p) @@ -17,7 +17,7 @@ final class MonadOps[F[_], A](val fa: F[A]) extends AnyVal { def iterateUntil(p: A => Boolean)(implicit M: Monad[F]): F[A] = M.iterateUntil(fa)(p) } -final class MonadIdOps[A](val a: A) extends AnyVal { +final class MonadIdOps[A](private val a: A) extends AnyVal { /** * Iterative application of `f` while `p` holds. diff --git a/core/src/main/scala/cats/syntax/monadError.scala b/core/src/main/scala/cats/syntax/monadError.scala index fd374464e9..b011762f0d 100644 --- a/core/src/main/scala/cats/syntax/monadError.scala +++ b/core/src/main/scala/cats/syntax/monadError.scala @@ -11,7 +11,7 @@ trait MonadErrorSyntax { new MonadErrorRethrowOps(fea) } -final class MonadErrorOps[F[_], E, A](val fa: F[A]) extends AnyVal { +final class MonadErrorOps[F[_], E, A](private val fa: F[A]) extends AnyVal { def ensure(error: => E)(predicate: A => Boolean)(implicit F: MonadError[F, E]): F[A] = F.ensure(fa)(error)(predicate) @@ -27,6 +27,6 @@ final class MonadErrorOps[F[_], E, A](val fa: F[A]) extends AnyVal { F.adaptError(fa)(pf) } -final class MonadErrorRethrowOps[F[_], E, A](val fea: F[Either[E, A]]) extends AnyVal { +final class MonadErrorRethrowOps[F[_], E, A](private val fea: F[Either[E, A]]) extends AnyVal { def rethrow(implicit F: MonadError[F, E]): F[A] = F.rethrow(fea) } diff --git a/core/src/main/scala/cats/syntax/monoid.scala b/core/src/main/scala/cats/syntax/monoid.scala index dcbf0fd680..4d7c2b9d29 100644 --- a/core/src/main/scala/cats/syntax/monoid.scala +++ b/core/src/main/scala/cats/syntax/monoid.scala @@ -7,6 +7,6 @@ trait MonoidSyntax extends SemigroupSyntax { new MonoidOps[A](a) } -final class MonoidOps[A](val lhs: A) extends AnyVal { +final class MonoidOps[A](private val lhs: A) extends AnyVal { def isEmpty(implicit A: Monoid[A], eq: Eq[A]): Boolean = A.isEmpty(lhs)(eq) } diff --git a/core/src/main/scala/cats/syntax/option.scala b/core/src/main/scala/cats/syntax/option.scala index 3b361b2bbb..ae6b78178b 100644 --- a/core/src/main/scala/cats/syntax/option.scala +++ b/core/src/main/scala/cats/syntax/option.scala @@ -10,7 +10,7 @@ trait OptionSyntax { implicit final def catsSyntaxOption[A](oa: Option[A]): OptionOps[A] = new OptionOps(oa) } -final class OptionIdOps[A](val a: A) extends AnyVal { +final class OptionIdOps[A](private val a: A) extends AnyVal { /** * Wrap a value in `Some`. @@ -28,7 +28,7 @@ final class OptionIdOps[A](val a: A) extends AnyVal { def some: Option[A] = Some(a) } -final class OptionOps[A](val oa: Option[A]) extends AnyVal { +final class OptionOps[A](private val oa: Option[A]) extends AnyVal { /** * If the `Option` is a `Some`, return its value in a [[cats.data.Validated.Invalid]]. diff --git a/core/src/main/scala/cats/syntax/parallel.scala b/core/src/main/scala/cats/syntax/parallel.scala index b7782f5d91..54cf041715 100644 --- a/core/src/main/scala/cats/syntax/parallel.scala +++ b/core/src/main/scala/cats/syntax/parallel.scala @@ -33,40 +33,40 @@ trait ParallelTraverseSyntax { new ParallelSequence_Ops[T, M, A](tma) } -final class ParallelTraversableOps[T[_], A](val ta: T[A]) extends AnyVal { +final class ParallelTraversableOps[T[_], A](private val ta: T[A]) extends AnyVal { def parTraverse[M[_]: Monad, F[_], B](f: A => M[B])(implicit T: Traverse[T], P: Parallel[M, F]): M[T[B]] = Parallel.parTraverse(ta)(f) } -final class ParallelTraversable_Ops[T[_], A](val ta: T[A]) extends AnyVal { +final class ParallelTraversable_Ops[T[_], A](private val ta: T[A]) extends AnyVal { def parTraverse_[M[_], F[_], B](f: A => M[B])(implicit T: Foldable[T], P: Parallel[M, F]): M[Unit] = Parallel.parTraverse_(ta)(f) } -final class ParallelFlatTraversableOps[T[_], A](val ta: T[A]) extends AnyVal { +final class ParallelFlatTraversableOps[T[_], A](private val ta: T[A]) extends AnyVal { def parFlatTraverse[M[_]: Monad, F[_], B]( f: A => M[T[B]] )(implicit T0: Traverse[T], T1: FlatMap[T], P: Parallel[M, F]): M[T[B]] = Parallel.parFlatTraverse(ta)(f) } -final class ParallelSequenceOps[T[_], M[_], A](val tma: T[M[A]]) extends AnyVal { +final class ParallelSequenceOps[T[_], M[_], A](private val tma: T[M[A]]) extends AnyVal { def parSequence[F[_]](implicit M: Monad[M], T: Traverse[T], P: Parallel[M, F]): M[T[A]] = Parallel.parSequence(tma) } -final class ParallelSequence_Ops[T[_], M[_], A](val tma: T[M[A]]) extends AnyVal { +final class ParallelSequence_Ops[T[_], M[_], A](private val tma: T[M[A]]) extends AnyVal { def parSequence_[F[_]](implicit T: Foldable[T], P: Parallel[M, F]): M[Unit] = Parallel.parSequence_(tma) } -final class ParallelFlatSequenceOps[T[_], M[_], A](val tmta: T[M[T[A]]]) extends AnyVal { +final class ParallelFlatSequenceOps[T[_], M[_], A](private val tmta: T[M[T[A]]]) extends AnyVal { def parFlatSequence[F[_]](implicit M: Monad[M], T0: Traverse[T], T1: FlatMap[T], P: Parallel[M, F]): M[T[A]] = Parallel.parFlatSequence(tmta) } -final class ParallelApOps[M[_], A](val ma: M[A]) extends AnyVal { +final class ParallelApOps[M[_], A](private val ma: M[A]) extends AnyVal { def &>[F[_], B](mb: M[B])(implicit P: Parallel[M, F]): M[B] = P.parProductR(ma)(mb) diff --git a/core/src/main/scala/cats/syntax/reducible.scala b/core/src/main/scala/cats/syntax/reducible.scala index 10f4487410..8e2e67ef43 100644 --- a/core/src/main/scala/cats/syntax/reducible.scala +++ b/core/src/main/scala/cats/syntax/reducible.scala @@ -6,6 +6,6 @@ trait ReducibleSyntax extends Reducible.ToReducibleOps { new NestedReducibleOps[F, G, A](fga) } -final class NestedReducibleOps[F[_], G[_], A](val fga: F[G[A]]) extends AnyVal { +final class NestedReducibleOps[F[_], G[_], A](private val fga: F[G[A]]) extends AnyVal { def reduceK(implicit F: Reducible[F], G: SemigroupK[G]): G[A] = F.reduceK(fga) } diff --git a/core/src/main/scala/cats/syntax/representable.scala b/core/src/main/scala/cats/syntax/representable.scala index e329c8c3a9..9920cb410b 100644 --- a/core/src/main/scala/cats/syntax/representable.scala +++ b/core/src/main/scala/cats/syntax/representable.scala @@ -9,10 +9,10 @@ trait RepresentableSyntax { new IndexOps[F, A](fa) } -final class IndexOps[F[_], A](val fa: F[A]) extends AnyVal { +final class IndexOps[F[_], A](private val fa: F[A]) extends AnyVal { def index[R](implicit R: Representable.Aux[F, R]): R => A = R.index(fa) } -final class TabulateOps[A, R](val f: R => A) extends AnyVal { +final class TabulateOps[A, R](private val f: R => A) extends AnyVal { def tabulate[F[_]](implicit R: Representable.Aux[F, R]): F[A] = R.tabulate(f) } diff --git a/core/src/main/scala/cats/syntax/set.scala b/core/src/main/scala/cats/syntax/set.scala index 09715d1698..1a78fb0680 100644 --- a/core/src/main/scala/cats/syntax/set.scala +++ b/core/src/main/scala/cats/syntax/set.scala @@ -8,7 +8,7 @@ trait SetSyntax { implicit final def catsSyntaxSet[A](se: SortedSet[A]): SetOps[A] = new SetOps(se) } -final class SetOps[A](val se: SortedSet[A]) extends AnyVal { +final class SetOps[A](private val se: SortedSet[A]) extends AnyVal { /** * Returns an Option of NonEmptySet from a SortedSet diff --git a/core/src/main/scala/cats/syntax/unorderedFoldable.scala b/core/src/main/scala/cats/syntax/unorderedFoldable.scala index 56a567376a..567780c529 100644 --- a/core/src/main/scala/cats/syntax/unorderedFoldable.scala +++ b/core/src/main/scala/cats/syntax/unorderedFoldable.scala @@ -8,7 +8,7 @@ trait UnorderedFoldableSyntax extends UnorderedFoldable.ToUnorderedFoldableOps { new UnorderedFoldableOps[F, A](fa) } -final class UnorderedFoldableOps[F[_], A](val fa: F[A]) extends AnyVal { +final class UnorderedFoldableOps[F[_], A](private val fa: F[A]) extends AnyVal { /** * Count the number of elements in the structure that satisfy the given predicate. diff --git a/core/src/main/scala/cats/syntax/validated.scala b/core/src/main/scala/cats/syntax/validated.scala index 175c40e83f..6e76c52cf3 100644 --- a/core/src/main/scala/cats/syntax/validated.scala +++ b/core/src/main/scala/cats/syntax/validated.scala @@ -7,7 +7,7 @@ trait ValidatedSyntax { implicit final def catsSyntaxValidatedId[A](a: A): ValidatedIdSyntax[A] = new ValidatedIdSyntax(a) } -final class ValidatedIdSyntax[A](val a: A) extends AnyVal { +final class ValidatedIdSyntax[A](private val a: A) extends AnyVal { def valid[B]: Validated[B, A] = Validated.Valid(a) def validNel[B]: ValidatedNel[B, A] = Validated.Valid(a) def invalid[B]: Validated[A, B] = Validated.Invalid(a) @@ -19,7 +19,7 @@ trait ValidatedExtensionSyntax { new ValidatedExtension(v) } -final class ValidatedExtension[E, A](val self: Validated[E, A]) extends AnyVal { +final class ValidatedExtension[E, A](private val self: Validated[E, A]) extends AnyVal { def liftTo[F[_]](implicit F: ApplicativeError[F, E]): F[A] = new ApplicativeErrorExtensionOps(F).fromValidated(self) } @@ -29,7 +29,7 @@ trait ValidatedSyntaxBincompat0 { new ValidatedIdOpsBinCompat0(a) } -final class ValidatedIdOpsBinCompat0[A](val a: A) extends AnyVal { +final class ValidatedIdOpsBinCompat0[A](private val a: A) extends AnyVal { /** * Wrap a value to a valid ValidatedNec diff --git a/core/src/main/scala/cats/syntax/vector.scala b/core/src/main/scala/cats/syntax/vector.scala index 213c221ccf..7214fbef2a 100644 --- a/core/src/main/scala/cats/syntax/vector.scala +++ b/core/src/main/scala/cats/syntax/vector.scala @@ -6,6 +6,6 @@ trait VectorSyntax { implicit final def catsSyntaxVectors[A](va: Vector[A]): VectorOps[A] = new VectorOps(va) } -final class VectorOps[A](val va: Vector[A]) extends AnyVal { +final class VectorOps[A](private val va: Vector[A]) extends AnyVal { def toNev: Option[NonEmptyVector[A]] = NonEmptyVector.fromVector(va) } diff --git a/core/src/main/scala/cats/syntax/writer.scala b/core/src/main/scala/cats/syntax/writer.scala index 31b36c66dd..1f7b055ff8 100644 --- a/core/src/main/scala/cats/syntax/writer.scala +++ b/core/src/main/scala/cats/syntax/writer.scala @@ -7,7 +7,7 @@ trait WriterSyntax { implicit final def catsSyntaxWriterId[A](a: A): WriterIdSyntax[A] = new WriterIdSyntax(a) } -final class WriterIdSyntax[A](val a: A) extends AnyVal { +final class WriterIdSyntax[A](private val a: A) extends AnyVal { def tell: Writer[A, Unit] = Writer(a, ()) def writer[W](w: W): Writer[W, A] = Writer(w, a) } diff --git a/free/src/main/scala/cats/free/Free.scala b/free/src/main/scala/cats/free/Free.scala index 5c86f0446b..c9a43ce996 100644 --- a/free/src/main/scala/cats/free/Free.scala +++ b/free/src/main/scala/cats/free/Free.scala @@ -262,7 +262,7 @@ object Free extends FreeInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[free] class FreeInjectKPartiallyApplied[F[_], G[_]](val dummy: Boolean = true) extends AnyVal { + final private[free] class FreeInjectKPartiallyApplied[F[_], G[_]](private val dummy: Boolean = true) extends AnyVal { def apply[A](fa: F[A])(implicit I: InjectK[F, G]): Free[G, A] = Free.liftF(I.inj(fa)) } @@ -281,7 +281,7 @@ object Free extends FreeInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[free] class FreeLiftInjectKPartiallyApplied[G[_]](val dummy: Boolean = true) extends AnyVal { + final private[free] class FreeLiftInjectKPartiallyApplied[G[_]](private val dummy: Boolean = true) extends AnyVal { def apply[F[_], A](fa: F[A])(implicit I: InjectK[F, G]): Free[G, A] = Free.liftF(I.inj(fa)) } diff --git a/free/src/main/scala/cats/free/FreeT.scala b/free/src/main/scala/cats/free/FreeT.scala index 800b3a34a3..23d49cdb91 100644 --- a/free/src/main/scala/cats/free/FreeT.scala +++ b/free/src/main/scala/cats/free/FreeT.scala @@ -212,7 +212,8 @@ object FreeT extends FreeTInstances { /** * Uses the [[http://typelevel.org/cats/guidelines.html#partially-applied-type-params Partially Applied Type Params technique]] for ergonomics. */ - final private[free] class FreeTLiftInjectKPartiallyApplied[M[_], G[_]](val dummy: Boolean = true) extends AnyVal { + final private[free] class FreeTLiftInjectKPartiallyApplied[M[_], G[_]](private val dummy: Boolean = true) + extends AnyVal { def apply[F[_], A](fa: F[A])(implicit I: InjectK[F, G], m: Applicative[M]): FreeT[G, M, A] = FreeT.liftF[G, M, A](I.inj(fa)) }