From 3dcddf766e6b50f7632ced3978747c782ad8afcc Mon Sep 17 00:00:00 2001 From: Kailuo Wang Date: Thu, 31 Aug 2017 16:55:12 -0400 Subject: [PATCH] convert trait into abstract class for better bin compact --- core/src/main/scala/cats/Eval.scala | 6 +++--- core/src/main/scala/cats/data/NonEmptyList.scala | 6 +++--- core/src/main/scala/cats/data/NonEmptyVector.scala | 2 +- core/src/main/scala/cats/data/OneAnd.scala | 10 +++++----- core/src/main/scala/cats/data/OptionT.scala | 10 +++++----- free/src/main/scala/cats/free/FreeT.scala | 10 +++++----- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/core/src/main/scala/cats/Eval.scala b/core/src/main/scala/cats/Eval.scala index 4361e9903b..91c142bf0e 100644 --- a/core/src/main/scala/cats/Eval.scala +++ b/core/src/main/scala/cats/Eval.scala @@ -326,7 +326,7 @@ object Eval extends EvalInstances { } } -private[cats] trait EvalInstances extends EvalInstances0 { +private[cats] sealed abstract class EvalInstances extends EvalInstances0 { implicit val catsBimonadForEval: Bimonad[Eval] = new Bimonad[Eval] with StackSafeMonad[Eval] { @@ -371,7 +371,7 @@ private[cats] trait EvalInstances extends EvalInstances0 { new EvalGroup[A] { val algebra: Group[A] = Group[A] } } -private[cats] trait EvalInstances0 extends EvalInstances1 { +private[cats] sealed abstract class EvalInstances0 extends EvalInstances1 { implicit def catsPartialOrderForEval[A: PartialOrder]: PartialOrder[Eval[A]] = new PartialOrder[Eval[A]] { def partialCompare(lx: Eval[A], ly: Eval[A]): Double = @@ -382,7 +382,7 @@ private[cats] trait EvalInstances0 extends EvalInstances1 { new EvalMonoid[A] { val algebra = Monoid[A] } } -private[cats] trait EvalInstances1 { +private[cats] sealed abstract class EvalInstances1 { implicit def catsEqForEval[A: Eq]: Eq[Eval[A]] = new Eq[Eval[A]] { def eqv(lx: Eval[A], ly: Eval[A]): Boolean = diff --git a/core/src/main/scala/cats/data/NonEmptyList.scala b/core/src/main/scala/cats/data/NonEmptyList.scala index 4de780ecca..3977c4cde3 100644 --- a/core/src/main/scala/cats/data/NonEmptyList.scala +++ b/core/src/main/scala/cats/data/NonEmptyList.scala @@ -362,7 +362,7 @@ object NonEmptyList extends NonEmptyListInstances { F.toNonEmptyList(fa) } -private[data] sealed trait NonEmptyListInstances extends NonEmptyListInstances0 { +private[data] sealed abstract class NonEmptyListInstances extends NonEmptyListInstances0 { implicit val catsDataInstancesForNonEmptyList: SemigroupK[NonEmptyList] with Reducible[NonEmptyList] with Comonad[NonEmptyList] with NonEmptyTraverse[NonEmptyList] with Monad[NonEmptyList] = @@ -458,14 +458,14 @@ private[data] sealed trait NonEmptyListInstances extends NonEmptyListInstances0 } } -private[data] sealed trait NonEmptyListInstances0 extends NonEmptyListInstances1 { +private[data] sealed abstract class NonEmptyListInstances0 extends NonEmptyListInstances1 { implicit def catsDataPartialOrderForNonEmptyList[A](implicit A: PartialOrder[A]): PartialOrder[NonEmptyList[A]] = new NonEmptyListPartialOrder[A] { val A0 = A } } -private[data] sealed trait NonEmptyListInstances1 { +private[data] sealed abstract class NonEmptyListInstances1 { implicit def catsDataEqForNonEmptyList[A](implicit A: Eq[A]): Eq[NonEmptyList[A]] = new NonEmptyListEq[A] { diff --git a/core/src/main/scala/cats/data/NonEmptyVector.scala b/core/src/main/scala/cats/data/NonEmptyVector.scala index 5b32ca145a..5c55f33e66 100644 --- a/core/src/main/scala/cats/data/NonEmptyVector.scala +++ b/core/src/main/scala/cats/data/NonEmptyVector.scala @@ -186,7 +186,7 @@ final class NonEmptyVector[+A] private (val toVector: Vector[A]) extends AnyVal } } -private[data] sealed trait NonEmptyVectorInstances { +private[data] sealed abstract class NonEmptyVectorInstances { implicit val catsDataInstancesForNonEmptyVector: SemigroupK[NonEmptyVector] with Reducible[NonEmptyVector] with Comonad[NonEmptyVector] with NonEmptyTraverse[NonEmptyVector] with Monad[NonEmptyVector] = diff --git a/core/src/main/scala/cats/data/OneAnd.scala b/core/src/main/scala/cats/data/OneAnd.scala index 43963d461a..03782ea486 100644 --- a/core/src/main/scala/cats/data/OneAnd.scala +++ b/core/src/main/scala/cats/data/OneAnd.scala @@ -98,7 +98,7 @@ final case class OneAnd[F[_], A](head: A, tail: F[A]) { s"OneAnd(${A.show(head)}, ${FA.show(tail)})" } -private[data] sealed trait OneAndInstances extends OneAndLowPriority3 { +private[data] sealed abstract class OneAndInstances extends OneAndLowPriority3 { implicit def catsDataEqForOneAnd[A, F[_]](implicit A: Eq[A], FA: Eq[F[A]]): Eq[OneAnd[F, A]] = new Eq[OneAnd[F, A]]{ @@ -178,7 +178,7 @@ private[data] sealed trait OneAndInstances extends OneAndLowPriority3 { } } -private[data] trait OneAndLowPriority0 { +private[data] sealed abstract class OneAndLowPriority0 { implicit val catsDataComonadForNonEmptyStream: Comonad[OneAnd[Stream, ?]] = new Comonad[OneAnd[Stream, ?]] { def coflatMap[A, B](fa: OneAnd[Stream, A])(f: OneAnd[Stream, A] => B): OneAnd[Stream, B] = { @@ -199,7 +199,7 @@ private[data] trait OneAndLowPriority0 { } } -private[data] trait OneAndLowPriority1 extends OneAndLowPriority0 { +private[data] sealed abstract class OneAndLowPriority1 extends OneAndLowPriority0 { implicit def catsDataFunctorForOneAnd[F[_]](implicit F: Functor[F]): Functor[OneAnd[F, ?]] = new Functor[OneAnd[F, ?]] { def map[A, B](fa: OneAnd[F, A])(f: A => B): OneAnd[F, B] = @@ -208,7 +208,7 @@ private[data] trait OneAndLowPriority1 extends OneAndLowPriority0 { } -private[data] trait OneAndLowPriority2 extends OneAndLowPriority1 { +private[data] sealed abstract class OneAndLowPriority2 extends OneAndLowPriority1 { implicit def catsDataTraverseForOneAnd[F[_]](implicit F: Traverse[F]): Traverse[OneAnd[F, ?]] = new Traverse[OneAnd[F, ?]] { def traverse[G[_], A, B](fa: OneAnd[F, A])(f: (A) => G[B])(implicit G: Applicative[G]): G[OneAnd[F, B]] = { @@ -225,7 +225,7 @@ private[data] trait OneAndLowPriority2 extends OneAndLowPriority1 { } } -private[data] trait OneAndLowPriority3 extends OneAndLowPriority2 { +private[data] sealed abstract class OneAndLowPriority3 extends OneAndLowPriority2 { implicit def catsDataNonEmptyTraverseForOneAnd[F[_]](implicit F: Traverse[F], F2: Alternative[F]): NonEmptyTraverse[OneAnd[F, ?]] = new NonEmptyReducible[OneAnd[F, ?], F] with NonEmptyTraverse[OneAnd[F, ?]] { def nonEmptyTraverse[G[_], A, B](fa: OneAnd[F, A])(f: (A) => G[B])(implicit G: Apply[G]): G[OneAnd[F, B]] = { diff --git a/core/src/main/scala/cats/data/OptionT.scala b/core/src/main/scala/cats/data/OptionT.scala index dfe8665675..67aac4fa1d 100644 --- a/core/src/main/scala/cats/data/OptionT.scala +++ b/core/src/main/scala/cats/data/OptionT.scala @@ -195,7 +195,7 @@ object OptionT extends OptionTInstances { def liftF[F[_], A](fa: F[A])(implicit F: Functor[F]): OptionT[F, A] = OptionT(F.map(fa)(Some(_))) } -private[data] sealed trait OptionTInstances extends OptionTInstances0 { +private[data] sealed abstract class OptionTInstances extends OptionTInstances0 { implicit def catsDataMonadForOptionT[F[_]](implicit F0: Monad[F]): Monad[OptionT[F, ?]] = new OptionTMonad[F] { implicit val F = F0 } @@ -212,7 +212,7 @@ private[data] sealed trait OptionTInstances extends OptionTInstances0 { functor.Contravariant[Show].contramap(F)(_.value) } -private[data] sealed trait OptionTInstances0 extends OptionTInstances1 { +private[data] sealed abstract class OptionTInstances0 extends OptionTInstances1 { implicit def catsDataMonadErrorForOptionT[F[_], E](implicit F0: MonadError[F, E]): MonadError[OptionT[F, ?], E] = new OptionTMonadError[F, E] { implicit val F = F0 } @@ -226,7 +226,7 @@ private[data] sealed trait OptionTInstances0 extends OptionTInstances1 { new OptionTPartialOrder[F, A] { implicit val F = F0 } } -private[data] sealed trait OptionTInstances1 extends OptionTInstances2 { +private[data] sealed abstract class OptionTInstances1 extends OptionTInstances2 { implicit def catsDataMonoidKForOptionT[F[_]](implicit F0: Monad[F]): MonoidK[OptionT[F, ?]] = new OptionTMonoidK[F] { implicit val F = F0 } @@ -235,12 +235,12 @@ private[data] sealed trait OptionTInstances1 extends OptionTInstances2 { new OptionTEq[F, A] { implicit val F = F0 } } -private[data] sealed trait OptionTInstances2 extends OptionTInstances3 { +private[data] sealed abstract class OptionTInstances2 extends OptionTInstances3 { implicit def catsDataTraverseForOptionT[F[_]](implicit F0: Traverse[F]): Traverse[OptionT[F, ?]] = new OptionTTraverse[F] { implicit val F = F0 } } -private[data] sealed trait OptionTInstances3 { +private[data] sealed abstract class OptionTInstances3 { implicit def catsDataFunctorForOptionT[F[_]](implicit F0: Functor[F]): Functor[OptionT[F, ?]] = new OptionTFunctor[F] { implicit val F = F0 } } diff --git a/free/src/main/scala/cats/free/FreeT.scala b/free/src/main/scala/cats/free/FreeT.scala index cb70e22b0f..630d7f0a33 100644 --- a/free/src/main/scala/cats/free/FreeT.scala +++ b/free/src/main/scala/cats/free/FreeT.scala @@ -182,7 +182,7 @@ object FreeT extends FreeTInstances { λ[FunctionK[FreeT[S, M, ?], M]](f => f.foldMap(fk)) } -private[free] sealed trait FreeTInstances extends FreeTInstances0 { +private[free] sealed abstract class FreeTInstances extends FreeTInstances0 { implicit def catsFreeMonadErrorForFreeT[S[_], M[_], E](implicit E: MonadError[M, E]): MonadError[FreeT[S, M, ?], E] = new MonadError[FreeT[S, M, ?], E] with FreeTMonad[S, M] { override def M = E @@ -193,21 +193,21 @@ private[free] sealed trait FreeTInstances extends FreeTInstances0 { } } -private[free] sealed trait FreeTInstances0 extends FreeTInstances1 { +private[free] sealed abstract class FreeTInstances0 extends FreeTInstances1 { implicit def catsFreeMonadForFreeT[S[_], M[_]](implicit M0: Applicative[M]): Monad[FreeT[S, M, ?]] = new FreeTMonad[S, M] { def M = M0 } } -private[free] sealed trait FreeTInstances1 extends FreeTInstances2 { +private[free] sealed abstract class FreeTInstances1 extends FreeTInstances2 { implicit def catsFreeFlatMapForFreeT[S[_], M[_]](implicit M0: Applicative[M]): FlatMap[FreeT[S, M, ?]] = new FreeTFlatMap[S, M] { implicit def M: Applicative[M] = M0 } } -private[free] sealed trait FreeTInstances2 extends FreeTInstances3 { +private[free] sealed abstract class FreeTInstances2 extends FreeTInstances3 { implicit def catsFreeAlternativeForFreeT[S[_], M[_]: Alternative: Monad]: Alternative[FreeT[S, M, ?]] = new Alternative[FreeT[S, M, ?]] with FreeTMonad[S, M] with FreeTMonoidK[S, M] { override def M = Alternative[M] @@ -215,7 +215,7 @@ private[free] sealed trait FreeTInstances2 extends FreeTInstances3 { } } -private[free] sealed trait FreeTInstances3 { +private[free] sealed abstract class FreeTInstances3 { implicit def catsFreeSemigroupKForFreeT[S[_], M[_]: Applicative: SemigroupK]: SemigroupK[FreeT[S, M, ?]] = new FreeTSemigroupK[S, M] { override def M = Applicative[M]