From 423b7ff1fbb48467559bf5fedccc38754deb463d Mon Sep 17 00:00:00 2001 From: Georgi Krastev Date: Sun, 21 Jan 2024 01:16:03 +0200 Subject: [PATCH] Add type aliases for composed type constructors (#642) Also qualify `Or` type aliases for better readability. --- .../main/scala-3/cats/derived/Derived.scala | 13 +++++---- .../cats/derived/DerivedAlternative.scala | 7 ++--- .../cats/derived/DerivedApplicative.scala | 11 +++++--- .../scala-3/cats/derived/DerivedApply.scala | 9 ++++--- .../cats/derived/DerivedContravariant.scala | 11 +++++--- .../scala-3/cats/derived/DerivedEmpty.scala | 9 ++++--- .../scala-3/cats/derived/DerivedEmptyK.scala | 27 +++++++++++-------- .../cats/derived/DerivedFoldable.scala | 11 ++++---- .../scala-3/cats/derived/DerivedFunctor.scala | 12 ++++++--- .../cats/derived/DerivedInvariant.scala | 10 ++++--- .../scala-3/cats/derived/DerivedMonoidK.scala | 17 ++++++------ .../derived/DerivedNonEmptyAlternative.scala | 7 ++--- .../derived/DerivedNonEmptyTraverse.scala | 13 ++++++--- .../scala-3/cats/derived/DerivedPure.scala | 9 ++++--- .../cats/derived/DerivedReducible.scala | 12 ++++++--- .../cats/derived/DerivedSemigroupK.scala | 17 ++++++------ .../scala-3/cats/derived/DerivedShow.scala | 5 ++-- .../cats/derived/DerivedShowPretty.scala | 7 +++-- .../cats/derived/DerivedTraverse.scala | 14 ++++++---- .../cats/derived/AlternativeSuite.scala | 3 ++- .../cats/derived/ApplicativeSuite.scala | 3 ++- .../scala-3/cats/derived/ApplySuite.scala | 3 ++- .../scala-3/cats/derived/FoldableSuite.scala | 3 ++- .../scala-3/cats/derived/FunctorSuite.scala | 5 ++-- .../scala-3/cats/derived/InvariantSuite.scala | 3 ++- .../scala-3/cats/derived/MonoidKSuite.scala | 5 ++-- .../derived/NonEmptyAlternativeSuite.scala | 3 ++- .../cats/derived/NonEmptyTraverseSuite.scala | 3 ++- .../scala-3/cats/derived/ReducibleSuite.scala | 3 ++- .../cats/derived/SemigroupKSuite.scala | 5 ++-- .../scala-3/cats/derived/TraverseSuite.scala | 3 ++- 31 files changed, 161 insertions(+), 102 deletions(-) diff --git a/core/src/main/scala-3/cats/derived/Derived.scala b/core/src/main/scala-3/cats/derived/Derived.scala index 9efcaf22..6f18d370 100644 --- a/core/src/main/scala-3/cats/derived/Derived.scala +++ b/core/src/main/scala-3/cats/derived/Derived.scala @@ -12,15 +12,18 @@ object Derived: extension [A](derived: Derived[A]) def instance: A = derived given [A]: Conversion[A, Derived[A]] = apply - type Or0[F[_]] = [x] =>> Or[F[x]] - type Or1[F[_[_]]] = [x[_]] =>> Or[F[x]] - type Or11[F[_[_[_]]]] = [x[_[_]]] =>> Or[F[x]] - type Or2[F[_[_, _]]] = [x[_, _]] =>> Or[F[x]] + infix type >>>[F[_], G[_]] = [x] =>> G[F[x]] + infix type <<<[F[_], G[_]] = [x] =>> F[G[x]] + + type Or0[F[_]] = [x] =>> Derived.Or[F[x]] + type Or1[F[_[_]]] = [x[_]] =>> Derived.Or[F[x]] + type Or11[F[_[_[_]]]] = [x[_[_]]] =>> Derived.Or[F[x]] + type Or2[F[_[_, _]]] = [x[_, _]] =>> Derived.Or[F[x]] opaque type Or[A] = A object Or extends OrInstances: def apply[A](instance: A): Or[A] = instance - extension [A](or: Or[A]) def unify: A = or + extension [A](derived: Or[A]) def unify: A = derived extension [I[f[_], t] <: K0.Instances[f, t], F[_], T](inst: I[Or0[F], T]) @targetName("unifyK0") def unify: I[F, T] = inst extension [I[f[_[_]], t[_]] <: K1.Instances[f, t], F[_[_]], T[_]](inst: I[Or1[F], T]) diff --git a/core/src/main/scala-3/cats/derived/DerivedAlternative.scala b/core/src/main/scala-3/cats/derived/DerivedAlternative.scala index a9a61c6c..9c2ef6b8 100644 --- a/core/src/main/scala-3/cats/derived/DerivedAlternative.scala +++ b/core/src/main/scala-3/cats/derived/DerivedAlternative.scala @@ -1,6 +1,7 @@ package cats.derived import cats.Alternative +import cats.derived.Derived.<<< import shapeless3.deriving.K1.* import scala.annotation.* @@ -25,10 +26,10 @@ object DerivedAlternative: summonInline[DerivedAlternative[F]].instance given nested[F[_], G[_]](using - F: => Or[F], + F: => DerivedAlternative.Or[F], G: => DerivedApplicative.Or[G] - ): DerivedAlternative[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with Alternative[[x] =>> F[G[x]]]: + ): DerivedAlternative[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with Alternative[F <<< G]: export delegate.* given product[F[_]](using inst: => ProductInstances[Or, F]): DerivedAlternative[F] = diff --git a/core/src/main/scala-3/cats/derived/DerivedApplicative.scala b/core/src/main/scala-3/cats/derived/DerivedApplicative.scala index 5ab4fb43..596a46f1 100644 --- a/core/src/main/scala-3/cats/derived/DerivedApplicative.scala +++ b/core/src/main/scala-3/cats/derived/DerivedApplicative.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Applicative, Monoid} import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -30,15 +31,19 @@ object DerivedApplicative: def pure[A](x: A): T = T.empty def ap[A, B](ff: T)(fa: T): T = T.combine(ff, fa) - given nested[F[_], G[_]](using F: => Or[F], G: => Or[G]): DerivedApplicative[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with Applicative[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using + F: => DerivedApplicative.Or[F], + G: => DerivedApplicative.Or[G] + ): DerivedApplicative[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with Applicative[F <<< G]: export delegate.* given [F[_]](using inst: => ProductInstances[Or, F]): DerivedApplicative[F] = Strict.product(using inst.unify) @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_]: Or, G[_]: Or]: DerivedApplicative[[x] =>> F[G[x]]] = nested + protected given [F[_]: DerivedApplicative.Or, G[_]: DerivedApplicative.Or]: DerivedApplicative[[x] =>> F[G[x]]] = + nested trait Product[T[f[_]] <: Applicative[f], F[_]](using inst: ProductInstances[T, F]) extends Applicative[F], diff --git a/core/src/main/scala-3/cats/derived/DerivedApply.scala b/core/src/main/scala-3/cats/derived/DerivedApply.scala index c512472d..100cd8c6 100644 --- a/core/src/main/scala-3/cats/derived/DerivedApply.scala +++ b/core/src/main/scala-3/cats/derived/DerivedApply.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Apply, Semigroup} import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -30,18 +31,18 @@ object DerivedApply: def ap[A, B](ff: T)(fa: T): T = T.combine(ff, fa) def map[A, B](fa: T)(f: A => B): T = fa - given nested[F[_], G[_]](using F: => Or[F], G: => Or[G]): DerivedApply[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with Apply[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using F: => DerivedApply.Or[F], G: => DerivedApply.Or[G]): DerivedApply[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with Apply[F <<< G]: export delegate.* given [F[_]](using inst: => ProductInstances[Or, F]): DerivedApply[F] = Strict.product(using inst.unify) @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_]: Or, G[_]: Or]: DerivedApply[[x] =>> F[G[x]]] = nested + protected given [F[_]: DerivedApply.Or, G[_]: DerivedApply.Or]: DerivedApply[[x] =>> F[G[x]]] = nested trait Product[T[f[_]] <: Apply[f], F[_]](using inst: ProductInstances[T, F]) extends Apply[F]: - private lazy val F = new DerivedFunctor.Generic[T, F] {} + private lazy val F = DerivedFunctor.Strict.product(using inst.widen).instance final override def map[A, B](fa: F[A])(f: A => B): F[B] = F.map(fa)(f) final override def ap[A, B](ff: F[A => B])(fa: F[A]): F[B] = inst.map2(ff, fa)([f[_]] => (F: T[f], ff: f[A => B], fa: f[A]) => F.ap(ff)(fa)) diff --git a/core/src/main/scala-3/cats/derived/DerivedContravariant.scala b/core/src/main/scala-3/cats/derived/DerivedContravariant.scala index 9283ae37..1b94a0ce 100644 --- a/core/src/main/scala-3/cats/derived/DerivedContravariant.scala +++ b/core/src/main/scala-3/cats/derived/DerivedContravariant.scala @@ -1,6 +1,7 @@ package cats.derived import cats.Contravariant +import cats.derived.Derived.<<< import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -30,15 +31,19 @@ object DerivedContravariant: given [T]: DerivedContravariant[Const[T]] = new Contravariant[Const[T]]: def contramap[A, B](fa: T)(f: B => A): T = fa - given nested[F[_], G[_]](using F: DerivedFunctor.Or[F], G: => Or[G]): DerivedContravariant[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.composeContravariant(using G.unify)) with Contravariant[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using + F: DerivedFunctor.Or[F], + G: => DerivedContravariant.Or[G] + ): DerivedContravariant[F <<< G] = + new Derived.Lazy(() => F.unify.composeContravariant(using G.unify)) with Contravariant[F <<< G]: export delegate.* given [F[_]](using inst: => Instances[Or, F]): DerivedContravariant[F] = generic(using inst.unify) @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_]: DerivedFunctor.Or, G[_]: Or]: DerivedContravariant[[x] =>> F[G[x]]] = nested + protected given [F[_]: DerivedFunctor.Or, G[_]: DerivedContravariant.Or]: DerivedContravariant[[x] =>> F[G[x]]] = + nested private def generic[F[_]: InstancesOf[Contravariant]]: DerivedContravariant[F] = new Generic[Contravariant, F] {} diff --git a/core/src/main/scala-3/cats/derived/DerivedEmpty.scala b/core/src/main/scala-3/cats/derived/DerivedEmpty.scala index 4e62fcbe..2f3da0af 100644 --- a/core/src/main/scala-3/cats/derived/DerivedEmpty.scala +++ b/core/src/main/scala-3/cats/derived/DerivedEmpty.scala @@ -24,12 +24,15 @@ object DerivedEmpty: import Strict.given summonInline[DerivedEmpty[A]].instance - given product[A: ProductInstancesOf[Or]]: DerivedEmpty[A] = Strict.product(using ProductInstances.unify) - inline given coproduct[A: CoproductGeneric]: DerivedEmpty[A] = Strict.coproduct + given product[A: ProductInstancesOf[DerivedEmpty.Or]]: DerivedEmpty[A] = + Strict.product(using ProductInstances.unify) + + inline given coproduct[A: CoproductGeneric]: DerivedEmpty[A] = + Strict.coproduct object Strict: given product[A: ProductInstancesOf[Empty]]: DerivedEmpty[A] = Empty(ProductInstances.construct([a] => (A: Empty[a]) => A.empty)) inline given coproduct[A: CoproductGeneric]: DerivedEmpty[A] = - Empty(CoproductGeneric.withOnly[Or, A]([a <: A] => (A: Or[a]) => A.unify.empty)) + Empty(CoproductGeneric.withOnly[DerivedEmpty.Or, A]([a <: A] => (A: DerivedEmpty.Or[a]) => A.unify.empty)) diff --git a/core/src/main/scala-3/cats/derived/DerivedEmptyK.scala b/core/src/main/scala-3/cats/derived/DerivedEmptyK.scala index e76f7645..27f5bb6d 100644 --- a/core/src/main/scala-3/cats/derived/DerivedEmptyK.scala +++ b/core/src/main/scala-3/cats/derived/DerivedEmptyK.scala @@ -1,6 +1,7 @@ package cats.derived import alleycats.{Empty, EmptyK} +import cats.derived.Derived.<<< import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -32,30 +33,33 @@ object DerivedEmptyK: given [T](using T: Empty[T]): DerivedEmptyK[Const[T]] = new EmptyK[Const[T]]: def empty[A]: T = T.empty - given nested[F[_], G[_]](using F: => Or[F]): DerivedEmptyK[[x] =>> F[G[x]]] = - new EmptyK[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using F: => DerivedEmptyK.Or[F]): DerivedEmptyK[F <<< G] = + new EmptyK[F <<< G]: lazy val f = F.unify def empty[A]: F[G[A]] = f.empty given nested[F[_], G[_]](using - NotGiven[Or[F]] - )(using F: DerivedPure.Or[F], G: => Or[G]): DerivedEmptyK[[x] =>> F[G[x]]] = - new EmptyK[[x] =>> F[G[x]]]: + NotGiven[DerivedEmptyK.Or[F]] + )(using F: DerivedPure.Or[F], G: => DerivedEmptyK.Or[G]): DerivedEmptyK[F <<< G] = + new EmptyK[F <<< G]: val f = F.unify lazy val g = G.unify def empty[A]: F[G[A]] = f.pure(g.empty) - given product[F[_]: ProductInstancesOf[Or]]: DerivedEmptyK[F] = Strict.product(using ProductInstances.unify) - inline given coproduct[F[_]: CoproductGeneric]: DerivedEmptyK[F] = Strict.coproduct + given product[F[_]: ProductInstancesOf[DerivedEmptyK.Or]]: DerivedEmptyK[F] = + Strict.product(using ProductInstances.unify) + + inline given coproduct[F[_]: CoproductGeneric]: DerivedEmptyK[F] = + Strict.coproduct @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_], G[_]](using F: Or[F]): DerivedEmptyK[[x] =>> F[G[x]]] = + protected given [F[_], G[_]](using F: DerivedEmptyK.Or[F]): DerivedEmptyK[[x] =>> F[G[x]]] = nested(using F) @deprecated("Kept for binary compatibility", "3.2.0") protected given [F[_], G[_]](using - ev: NotGiven[Or[F]] - )(using DerivedPure.Or[F], Or[G]): DerivedEmptyK[[x] =>> F[G[x]]] = + ev: NotGiven[DerivedEmptyK.Or[F]] + )(using DerivedPure.Or[F], DerivedEmptyK.Or[G]): DerivedEmptyK[[x] =>> F[G[x]]] = nested(using ev) object Strict: @@ -63,4 +67,5 @@ object DerivedEmptyK: def empty[A]: F[A] = ProductInstances.construct([f[_]] => (F: EmptyK[f]) => F.empty[A]) inline given coproduct[F[_]: CoproductGeneric]: DerivedEmptyK[F] = - CoproductGeneric.withOnly[Or, EmptyK[F]]([f[x] <: F[x]] => (F: Or[f]) => F.unify.asInstanceOf[EmptyK[F]]) + CoproductGeneric.withOnly[DerivedEmptyK.Or, EmptyK[F]]: + [f[x] <: F[x]] => (F: DerivedEmptyK.Or[f]) => F.unify.asInstanceOf[EmptyK[F]] diff --git a/core/src/main/scala-3/cats/derived/DerivedFoldable.scala b/core/src/main/scala-3/cats/derived/DerivedFoldable.scala index b3b0df8c..c323aa06 100644 --- a/core/src/main/scala-3/cats/derived/DerivedFoldable.scala +++ b/core/src/main/scala-3/cats/derived/DerivedFoldable.scala @@ -1,8 +1,9 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Eval, Foldable} -import shapeless3.deriving.{Const, Continue} import shapeless3.deriving.K1.* +import shapeless3.deriving.{Const, Continue} import scala.annotation.* import scala.compiletime.* @@ -31,18 +32,18 @@ object DerivedFoldable: def foldLeft[A, B](fa: T, b: B)(f: (B, A) => B): B = b def foldRight[A, B](fa: T, lb: Eval[B])(f: (A, Eval[B]) => Eval[B]): Eval[B] = lb - given nested[F[_], G[_]](using F: => Or[F], G: => Or[G]): DerivedFoldable[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with Foldable[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using F: => DerivedFoldable.Or[F], G: => DerivedFoldable.Or[G]): DerivedFoldable[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with Foldable[F <<< G]: export delegate.* - given [F[_]: ProductInstancesOf[Or]]: DerivedFoldable[F] = + given [F[_]: ProductInstancesOf[DerivedFoldable.Or]]: DerivedFoldable[F] = Strict.product(using ProductInstances.unify) given [F[_]](using => CoproductInstances[Or, F]): DerivedFoldable[F] = Strict.coproduct @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_]: Or, G[_]: Or]: DerivedFoldable[[x] =>> F[G[x]]] = nested + protected given [F[_]: DerivedFoldable.Or, G[_]: DerivedFoldable.Or]: DerivedFoldable[[x] =>> F[G[x]]] = nested trait Product[T[f[_]] <: Foldable[f], F[_]](using inst: ProductInstances[T, F]) extends Foldable[F]: final override def foldLeft[A, B](fa: F[A], b: B)(f: (B, A) => B): B = diff --git a/core/src/main/scala-3/cats/derived/DerivedFunctor.scala b/core/src/main/scala-3/cats/derived/DerivedFunctor.scala index d4ff974e..b7ab5590 100644 --- a/core/src/main/scala-3/cats/derived/DerivedFunctor.scala +++ b/core/src/main/scala-3/cats/derived/DerivedFunctor.scala @@ -1,6 +1,7 @@ package cats.derived import cats.Functor +import cats.derived.Derived.<<< import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -31,21 +32,24 @@ object DerivedFunctor: given [T]: DerivedFunctor[Const[T]] = new Functor[Const[T]]: def map[A, B](fa: T)(f: A => B): T = fa - given nested[F[_], G[_]](using F: => Or[F], G: => Or[G]): DerivedFunctor[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with Functor[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using F: => DerivedFunctor.Or[F], G: => DerivedFunctor.Or[G]): DerivedFunctor[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with Functor[F <<< G]: export delegate.* given nested[F[_], G[_]](using F: DerivedContravariant.Or[F], G: DerivedContravariant.Or[G] - ): DerivedFunctor[[x] =>> F[G[x]]] = + ): DerivedFunctor[F <<< G] = F.unify.compose(using G.unify) given [F[_]](using inst: => Instances[Or, F]): DerivedFunctor[F] = generic(using inst.unify) @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_], G[_]](using F: Or[F], G: Or[G]): DerivedFunctor[[x] =>> F[G[x]]] = + protected given [F[_], G[_]](using + F: DerivedFunctor.Or[F], + G: DerivedFunctor.Or[G] + ): DerivedFunctor[[x] =>> F[G[x]]] = nested(using F, G) @deprecated("Kept for binary compatibility", "3.2.0") diff --git a/core/src/main/scala-3/cats/derived/DerivedInvariant.scala b/core/src/main/scala-3/cats/derived/DerivedInvariant.scala index 36464eac..6f4a5106 100644 --- a/core/src/main/scala-3/cats/derived/DerivedInvariant.scala +++ b/core/src/main/scala-3/cats/derived/DerivedInvariant.scala @@ -1,6 +1,7 @@ package cats.derived import cats.Invariant +import cats.derived.Derived.<<< import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -30,15 +31,18 @@ object DerivedInvariant: given [T]: DerivedInvariant[Const[T]] = new Invariant[Const[T]]: def imap[A, B](fa: T)(f: A => B)(g: B => A): T = fa - given nested[F[_], G[_]](using F: => Or[F], G: => Or[G]): DerivedInvariant[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with Invariant[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using + F: => DerivedInvariant.Or[F], + G: => DerivedInvariant.Or[G] + ): DerivedInvariant[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with Invariant[F <<< G]: export delegate.* given [F[_]](using inst: => Instances[Or, F]): DerivedInvariant[F] = generic(using inst.unify) @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_]: Or, G[_]: Or]: DerivedInvariant[[x] =>> F[G[x]]] = nested + protected given [F[_]: DerivedInvariant.Or, G[_]: DerivedInvariant.Or]: DerivedInvariant[[x] =>> F[G[x]]] = nested private def generic[F[_]: InstancesOf[Invariant]]: DerivedInvariant[F] = new Generic[Invariant, F] {} diff --git a/core/src/main/scala-3/cats/derived/DerivedMonoidK.scala b/core/src/main/scala-3/cats/derived/DerivedMonoidK.scala index 6adfe419..6eaf8aae 100644 --- a/core/src/main/scala-3/cats/derived/DerivedMonoidK.scala +++ b/core/src/main/scala-3/cats/derived/DerivedMonoidK.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Monoid, MonoidK} import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -32,14 +33,14 @@ object DerivedMonoidK: def empty[A]: T = T.empty def combineK[A](x: T, y: T): T = T.combine(x, y) - given nested[F[_], G[_]](using F: => Or[F]): DerivedMonoidK[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose[G]) with MonoidK[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using F: => DerivedMonoidK.Or[F]): DerivedMonoidK[F <<< G] = + new Derived.Lazy(() => F.unify.compose[G]) with MonoidK[F <<< G]: export delegate.* given nested[F[_], G[_]](using - NotGiven[Or[F]] - )(using F: DerivedApplicative.Or[F], G: => Or[G]): DerivedMonoidK[[x] =>> F[G[x]]] = - new MonoidK[[x] =>> F[G[x]]]: + NotGiven[DerivedMonoidK.Or[F]] + )(using F: DerivedApplicative.Or[F], G: => DerivedMonoidK.Or[G]): DerivedMonoidK[F <<< G] = + new MonoidK[F <<< G]: val f = F.unify lazy val g = G.unify def empty[A]: F[G[A]] = f.pure(g.empty[A]) @@ -49,13 +50,13 @@ object DerivedMonoidK: Strict.product(using inst.unify) @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_], G[_]](using F: Or[F]): DerivedMonoidK[[x] =>> F[G[x]]] = + protected given [F[_], G[_]](using F: DerivedMonoidK.Or[F]): DerivedMonoidK[[x] =>> F[G[x]]] = nested(using F) @deprecated("Kept for binary compatibility", "3.2.0") protected given [F[_], G[_]](using - ev: NotGiven[Or[F]] - )(using F: DerivedApplicative.Or[F], G: Or[G]): DerivedMonoidK[[x] =>> F[G[x]]] = + ev: NotGiven[DerivedMonoidK.Or[F]] + )(using F: DerivedApplicative.Or[F], G: DerivedMonoidK.Or[G]): DerivedMonoidK[[x] =>> F[G[x]]] = nested(using ev) trait Product[T[f[_]] <: MonoidK[f], F[_]](using inst: ProductInstances[T, F]) diff --git a/core/src/main/scala-3/cats/derived/DerivedNonEmptyAlternative.scala b/core/src/main/scala-3/cats/derived/DerivedNonEmptyAlternative.scala index 7496a5fd..33cfa9ed 100644 --- a/core/src/main/scala-3/cats/derived/DerivedNonEmptyAlternative.scala +++ b/core/src/main/scala-3/cats/derived/DerivedNonEmptyAlternative.scala @@ -1,6 +1,7 @@ package cats.derived import cats.NonEmptyAlternative +import cats.derived.Derived.<<< import shapeless3.deriving.K1.* import scala.annotation.* @@ -25,10 +26,10 @@ object DerivedNonEmptyAlternative: summonInline[DerivedNonEmptyAlternative[F]].instance given nested[F[_], G[_]](using - F: => Or[F], + F: => DerivedNonEmptyAlternative.Or[F], G: => DerivedApplicative.Or[G] - ): DerivedNonEmptyAlternative[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with NonEmptyAlternative[[x] =>> F[G[x]]]: + ): DerivedNonEmptyAlternative[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with NonEmptyAlternative[F <<< G]: export delegate.* given product[F[_]](using inst: => ProductInstances[Or, F]): DerivedNonEmptyAlternative[F] = diff --git a/core/src/main/scala-3/cats/derived/DerivedNonEmptyTraverse.scala b/core/src/main/scala-3/cats/derived/DerivedNonEmptyTraverse.scala index c0714a0a..b390f4ae 100644 --- a/core/src/main/scala-3/cats/derived/DerivedNonEmptyTraverse.scala +++ b/core/src/main/scala-3/cats/derived/DerivedNonEmptyTraverse.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Applicative, Apply, NonEmptyTraverse, Traverse} import shapeless3.deriving.K1.* @@ -27,21 +28,25 @@ object DerivedNonEmptyTraverse: import DerivedNonEmptyTraverse.Strict.given summonInline[DerivedNonEmptyTraverse[F]].instance - given nested[F[_], G[_]](using F: => Or[F], G: => Or[G]): DerivedNonEmptyTraverse[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with NonEmptyTraverse[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using + F: => DerivedNonEmptyTraverse.Or[F], + G: => DerivedNonEmptyTraverse.Or[G] + ): DerivedNonEmptyTraverse[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with NonEmptyTraverse[F <<< G]: export delegate.* def product[F[_]: ProductInstancesOf[DerivedTraverse.Or]](ev: NonEmptyTraverse[?]): DerivedNonEmptyTraverse[F] = Strict.product(ev)(using ProductInstances.unify) inline given product[F[_]](using gen: ProductGeneric[F]): DerivedNonEmptyTraverse[F] = - product(summonFirst[Or, gen.MirroredElemTypes].unify) + product(summonFirst[DerivedNonEmptyTraverse.Or, gen.MirroredElemTypes].unify) given [F[_]](using => CoproductInstances[Or, F]): DerivedNonEmptyTraverse[F] = Strict.coproduct @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_]: Or, G[_]: Or]: DerivedNonEmptyTraverse[[x] =>> F[G[x]]] = nested + protected given [F[_]: DerivedNonEmptyTraverse.Or, G[_]: DerivedNonEmptyTraverse.Or] + : DerivedNonEmptyTraverse[[x] =>> F[G[x]]] = nested trait Product[T[x[_]] <: Traverse[x], F[_]](@unused ev: NonEmptyTraverse[?])(using @unused inst: ProductInstances[T, F] diff --git a/core/src/main/scala-3/cats/derived/DerivedPure.scala b/core/src/main/scala-3/cats/derived/DerivedPure.scala index 0e53e522..a5eff25d 100644 --- a/core/src/main/scala-3/cats/derived/DerivedPure.scala +++ b/core/src/main/scala-3/cats/derived/DerivedPure.scala @@ -1,6 +1,7 @@ package cats.derived import alleycats.{Empty, Pure} +import cats.derived.Derived.<<< import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -32,17 +33,17 @@ object DerivedPure: given [T <: Singleton: ValueOf]: DerivedPure[Const[T]] = new Pure[Const[T]]: def pure[A](a: A): T = valueOf[T] - given nested[F[_], G[_]](using F: => Or[F], G: => Or[G]): DerivedPure[[x] =>> F[G[x]]] = - new Pure[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using F: => DerivedPure.Or[F], G: => DerivedPure.Or[G]): DerivedPure[F <<< G] = + new Pure[F <<< G]: lazy val f = F.unify lazy val g = G.unify def pure[A](a: A): F[G[A]] = f.pure(g.pure(a)) - given [F[_]: ProductInstancesOf[Or]]: DerivedPure[F] = + given [F[_]: ProductInstancesOf[DerivedPure.Or]]: DerivedPure[F] = Strict.product(using ProductInstances.unify) @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_]: Or, G[_]: Or]: DerivedPure[[x] =>> F[G[x]]] = nested + protected given [F[_]: DerivedPure.Or, G[_]: DerivedPure.Or]: DerivedPure[[x] =>> F[G[x]]] = nested object Strict: given product[F[_]: ProductInstancesOf[Pure]]: DerivedPure[F] = new Pure[F]: diff --git a/core/src/main/scala-3/cats/derived/DerivedReducible.scala b/core/src/main/scala-3/cats/derived/DerivedReducible.scala index 6a3addd6..1ccc463c 100644 --- a/core/src/main/scala-3/cats/derived/DerivedReducible.scala +++ b/core/src/main/scala-3/cats/derived/DerivedReducible.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Eval, Foldable, Reducible} import shapeless3.deriving.Continue import shapeless3.deriving.K1.* @@ -28,21 +29,24 @@ object DerivedReducible: import DerivedReducible.Strict.given summonInline[DerivedReducible[F]].instance - given nested[F[_], G[_]](using F: => Or[F], G: => Or[G]): DerivedReducible[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with Reducible[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using + F: => DerivedReducible.Or[F], + G: => DerivedReducible.Or[G] + ): DerivedReducible[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with Reducible[F <<< G]: export delegate.* def product[F[_]: ProductInstancesOf[DerivedFoldable.Or]](ev: Reducible[?]): DerivedReducible[F] = Strict.product(ev)(using ProductInstances.unify) inline given product[F[_]](using gen: ProductGeneric[F]): DerivedReducible[F] = - product(summonFirst[Or, gen.MirroredElemTypes].unify) + product(summonFirst[DerivedReducible.Or, gen.MirroredElemTypes].unify) given [F[_]](using => CoproductInstances[Or, F]): DerivedReducible[F] = Strict.coproduct @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_]: Or, G[_]: Or]: DerivedReducible[[x] =>> F[G[x]]] = nested + protected given [F[_]: DerivedReducible.Or, G[_]: DerivedReducible.Or]: DerivedReducible[[x] =>> F[G[x]]] = nested trait Product[T[f[_]] <: Foldable[f], F[_]](@unused ev: Reducible[?])(using inst: ProductInstances[T, F]) extends DerivedFoldable.Product[T, F], diff --git a/core/src/main/scala-3/cats/derived/DerivedSemigroupK.scala b/core/src/main/scala-3/cats/derived/DerivedSemigroupK.scala index c73d255e..5ffb7a33 100644 --- a/core/src/main/scala-3/cats/derived/DerivedSemigroupK.scala +++ b/core/src/main/scala-3/cats/derived/DerivedSemigroupK.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Semigroup, SemigroupK} import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -31,14 +32,14 @@ object DerivedSemigroupK: given [T](using T: Semigroup[T]): DerivedSemigroupK[Const[T]] = new SemigroupK[Const[T]]: def combineK[A](x: T, y: T): T = T.combine(x, y) - given nested[F[_], G[_]](using F: => Or[F]): DerivedSemigroupK[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose[G]) with SemigroupK[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using F: => DerivedSemigroupK.Or[F]): DerivedSemigroupK[F <<< G] = + new Derived.Lazy(() => F.unify.compose[G]) with SemigroupK[F <<< G]: export delegate.* given nested[F[_], G[_]](using - NotGiven[Or[F]] - )(using F: DerivedApply.Or[F], G: => Or[G]): DerivedSemigroupK[[x] =>> F[G[x]]] = - new SemigroupK[[x] =>> F[G[x]]]: + NotGiven[DerivedSemigroupK.Or[F]] + )(using F: DerivedApply.Or[F], G: => DerivedSemigroupK.Or[G]): DerivedSemigroupK[F <<< G] = + new SemigroupK[F <<< G]: val f = F.unify lazy val g = G.unify def combineK[A](x: F[G[A]], y: F[G[A]]): F[G[A]] = f.map2(x, y)(g.combineK) @@ -47,13 +48,13 @@ object DerivedSemigroupK: Strict.product(using inst.unify) @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_], G[_]](using F: Or[F]): DerivedSemigroupK[[x] =>> F[G[x]]] = + protected given [F[_], G[_]](using F: DerivedSemigroupK.Or[F]): DerivedSemigroupK[[x] =>> F[G[x]]] = nested(using F) @deprecated("Kept for binary compatibility", "3.2.0") protected given [F[_], G[_]](using - ev: NotGiven[Or[F]] - )(using F: DerivedApply.Or[F], G: Or[G]): DerivedSemigroupK[[x] =>> F[G[x]]] = + ev: NotGiven[DerivedSemigroupK.Or[F]] + )(using F: DerivedApply.Or[F], G: DerivedSemigroupK.Or[G]): DerivedSemigroupK[[x] =>> F[G[x]]] = nested(using ev) trait Product[T[f[_]] <: SemigroupK[f], F[_]](using inst: ProductInstances[T, F]) extends SemigroupK[F]: diff --git a/core/src/main/scala-3/cats/derived/DerivedShow.scala b/core/src/main/scala-3/cats/derived/DerivedShow.scala index 0bd267a5..a1adb97b 100644 --- a/core/src/main/scala-3/cats/derived/DerivedShow.scala +++ b/core/src/main/scala-3/cats/derived/DerivedShow.scala @@ -37,7 +37,7 @@ object DerivedShow: given string[A <: String]: DerivedShow[A] = Show.fromToString given symbol[A <: Symbol]: DerivedShow[A] = Show.fromToString - given [A: ProductInstancesOf[Or]](using labelling: Labelling[A]): DerivedShow[A] = + given [A: ProductInstancesOf[DerivedShow.Or]](using labelling: Labelling[A]): DerivedShow[A] = Strict.product(using labelling, ProductInstances.unify) given [A](using => CoproductInstances[Or, A]): DerivedShow[A] = @@ -66,8 +66,7 @@ object DerivedShow: sb.toString trait Coproduct[F[x] <: Show[x], A](using inst: CoproductInstances[F, A]) extends Show[A]: - def show(a: A): String = - inst.fold(a)([t] => (st: F[t], t: t) => st.show(t)) + def show(a: A): String = inst.fold(a)([t] => (st: F[t], t: t) => st.show(t)) object Strict: given product[A: Labelling](using => ProductInstances[Show, A]): DerivedShow[A] = diff --git a/core/src/main/scala-3/cats/derived/DerivedShowPretty.scala b/core/src/main/scala-3/cats/derived/DerivedShowPretty.scala index 7a7ccfba..14248034 100644 --- a/core/src/main/scala-3/cats/derived/DerivedShowPretty.scala +++ b/core/src/main/scala-3/cats/derived/DerivedShowPretty.scala @@ -59,7 +59,7 @@ object DerivedShowPretty: given coproduct[A](using => CoproductInstances[Or, A]): DerivedShowPretty[A] = new Coproduct[A] {} @deprecated("Kept for binary compatibility", "3.2.0") - protected given [A: ProductInstancesOf[Or]: Labelling]: DerivedShowPretty[A] = product + protected given [A: ProductInstancesOf[DerivedShowPretty.Or]: Labelling]: DerivedShowPretty[A] = product @deprecated("Kept for binary compatibility", "3.2.0") protected given [A](using => CoproductInstances[Or, A]): DerivedShowPretty[A] = coproduct @@ -85,11 +85,10 @@ object DerivedShowPretty: s"$prefix(" :: lines trait Coproduct[A](using inst: CoproductInstances[Or, A]) extends ShowPretty[A]: - def showLines(a: A): List[String] = - inst.fold(a)([a] => (show: Or[a], x: a) => show(x)) + def showLines(a: A): List[String] = inst.fold(a)([a] => (show: DerivedShowPretty.Or[a], x: a) => show(x)) object Strict: export DerivedShowPretty.coproduct given product[A: Labelling](using inst: => ProductInstances[Show, A]): DerivedShowPretty[A] = - given ProductInstances[Or, A] = inst.mapK([a] => (show: Show[a]) => Or.fromShow(show)) + given ProductInstances[Or, A] = inst.mapK([a] => (show: Show[a]) => DerivedShowPretty.Or.fromShow(show)) DerivedShowPretty.product diff --git a/core/src/main/scala-3/cats/derived/DerivedTraverse.scala b/core/src/main/scala-3/cats/derived/DerivedTraverse.scala index 3f9a3613..c411a9a4 100644 --- a/core/src/main/scala-3/cats/derived/DerivedTraverse.scala +++ b/core/src/main/scala-3/cats/derived/DerivedTraverse.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Applicative, Eval, Traverse} import shapeless3.deriving.Const import shapeless3.deriving.K1.* @@ -33,15 +34,18 @@ object DerivedTraverse: override def foldRight[A, B](fa: T, lb: Eval[B])(f: (A, Eval[B]) => Eval[B]): Eval[B] = lb override def traverse[G[_], A, B](fa: T)(f: A => G[B])(using G: Applicative[G]): G[T] = G.pure(fa) - given nested[F[_], G[_]](using F: => Or[F], G: => Or[G]): DerivedTraverse[[x] =>> F[G[x]]] = - new Derived.Lazy(() => F.unify.compose(using G.unify)) with Traverse[[x] =>> F[G[x]]]: + given nested[F[_], G[_]](using F: => DerivedTraverse.Or[F], G: => DerivedTraverse.Or[G]): DerivedTraverse[F <<< G] = + new Derived.Lazy(() => F.unify.compose(using G.unify)) with Traverse[F <<< G]: export delegate.* - given [F[_]: ProductInstancesOf[Or]]: DerivedTraverse[F] = Strict.product(using ProductInstances.unify) - given [F[_]](using => CoproductInstances[Or, F]): DerivedTraverse[F] = Strict.coproduct + given [F[_]: ProductInstancesOf[DerivedTraverse.Or]]: DerivedTraverse[F] = + Strict.product(using ProductInstances.unify) + + given [F[_]](using => CoproductInstances[Or, F]): DerivedTraverse[F] = + Strict.coproduct @deprecated("Kept for binary compatibility", "3.2.0") - protected given [F[_]: Or, G[_]: Or]: DerivedTraverse[[x] =>> F[G[x]]] = nested + protected given [F[_]: DerivedTraverse.Or, G[_]: DerivedTraverse.Or]: DerivedTraverse[[x] =>> F[G[x]]] = nested trait Product[T[f[_]] <: Traverse[f], F[_]](using inst: ProductInstances[T, F]) extends Traverse[F], diff --git a/core/src/test/scala-3/cats/derived/AlternativeSuite.scala b/core/src/test/scala-3/cats/derived/AlternativeSuite.scala index 10540884..31c100e5 100644 --- a/core/src/test/scala-3/cats/derived/AlternativeSuite.scala +++ b/core/src/test/scala-3/cats/derived/AlternativeSuite.scala @@ -16,6 +16,7 @@ package cats.derived +import cats.derived.Derived.<<< import cats.laws.discipline.* import cats.{Alternative, Applicative} import org.scalacheck.Arbitrary @@ -68,7 +69,7 @@ object AlternativeSuite: given Alternative[UnCons] = semiauto.alternative object strictInstances: - given [F[_]: Alternative, G[_]: Applicative]: Alternative[[x] =>> F[G[x]]] = Alternative[F].compose[G] + given [F[_]: Alternative, G[_]: Applicative]: Alternative[F <<< G] = Alternative[F].compose[G] given Alternative[CaseClassWOption] = strict.semiauto.alternative given Alternative[UnCons] = strict.semiauto.alternative diff --git a/core/src/test/scala-3/cats/derived/ApplicativeSuite.scala b/core/src/test/scala-3/cats/derived/ApplicativeSuite.scala index a16bad99..2af5e1ee 100644 --- a/core/src/test/scala-3/cats/derived/ApplicativeSuite.scala +++ b/core/src/test/scala-3/cats/derived/ApplicativeSuite.scala @@ -16,6 +16,7 @@ package cats.derived +import cats.derived.Derived.<<< import cats.laws.discipline.* import cats.{Applicative, Monoid} import org.scalacheck.Arbitrary @@ -78,7 +79,7 @@ object ApplicativeSuite: object strictInstances: given [T: Monoid]: Applicative[Const[T]] = semiauto.applicative - given [F[_]: Applicative, G[_]: Applicative]: Applicative[[x] =>> F[G[x]]] = Applicative[F].compose[G] + given [F[_]: Applicative, G[_]: Applicative]: Applicative[F <<< G] = Applicative[F].compose[G] given Applicative[Box] = strict.semiauto.applicative given Applicative[CaseClassWOption] = strict.semiauto.applicative given Applicative[AndInt] = strict.semiauto.applicative diff --git a/core/src/test/scala-3/cats/derived/ApplySuite.scala b/core/src/test/scala-3/cats/derived/ApplySuite.scala index d3b596f1..7cac8157 100644 --- a/core/src/test/scala-3/cats/derived/ApplySuite.scala +++ b/core/src/test/scala-3/cats/derived/ApplySuite.scala @@ -16,6 +16,7 @@ package cats.derived +import cats.derived.Derived.<<< import cats.laws.discipline.* import cats.{Apply, Semigroup} import shapeless3.deriving.Const @@ -79,7 +80,7 @@ object ApplySuite: object strictInstances: given [T: Semigroup]: Apply[Const[T]] = semiauto.apply - given [F[_]: Apply, G[_]: Apply]: Apply[[x] =>> F[G[x]]] = Apply[F].compose[G] + given [F[_]: Apply, G[_]: Apply]: Apply[F <<< G] = Apply[F].compose[G] given Apply[Box] = strict.semiauto.apply given Apply[CaseClassWOption] = strict.semiauto.apply given Apply[AndInt] = strict.semiauto.apply diff --git a/core/src/test/scala-3/cats/derived/FoldableSuite.scala b/core/src/test/scala-3/cats/derived/FoldableSuite.scala index 26a51dd7..7a34572a 100644 --- a/core/src/test/scala-3/cats/derived/FoldableSuite.scala +++ b/core/src/test/scala-3/cats/derived/FoldableSuite.scala @@ -16,6 +16,7 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Eval, Foldable} import cats.laws.discipline.* import cats.syntax.all.given @@ -103,7 +104,7 @@ object FoldableSuite: object strictInstances: given [T]: Foldable[Const[T]] = semiauto.foldable - given [F[_]: Foldable, G[_]: Foldable]: Foldable[[x] =>> F[G[x]]] = Foldable[F].compose[G] + given [F[_]: Foldable, G[_]: Foldable]: Foldable[F <<< G] = Foldable[F].compose[G] given Foldable[Snoc] = strict.semiauto.foldable given Foldable[IList] = strict.semiauto.foldable given Foldable[Tree] = strict.semiauto.foldable diff --git a/core/src/test/scala-3/cats/derived/FunctorSuite.scala b/core/src/test/scala-3/cats/derived/FunctorSuite.scala index e75cdd86..fb2e30d3 100644 --- a/core/src/test/scala-3/cats/derived/FunctorSuite.scala +++ b/core/src/test/scala-3/cats/derived/FunctorSuite.scala @@ -16,6 +16,7 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Contravariant, Functor} import cats.laws.discipline.* import cats.laws.discipline.eq.* @@ -107,8 +108,8 @@ object FunctorSuite: object strictInstances: given [T]: Functor[Const[T]] = semiauto.functor - given [F[_]: Functor, G[_]: Functor]: Functor[[x] =>> F[G[x]]] = Functor[F].compose[G] - given [F[_]: Contravariant, G[_]: Contravariant]: Functor[[x] =>> F[G[x]]] = Contravariant[F].compose[G] + given [F[_]: Functor, G[_]: Functor]: Functor[F <<< G] = Functor[F].compose[G] + given [F[_]: Contravariant, G[_]: Contravariant]: Functor[F <<< G] = Contravariant[F].compose[G] given Functor[Snoc] = strict.semiauto.functor given Functor[IList] = strict.semiauto.functor given Functor[Tree] = strict.semiauto.functor diff --git a/core/src/test/scala-3/cats/derived/InvariantSuite.scala b/core/src/test/scala-3/cats/derived/InvariantSuite.scala index e4c7a3ca..be0b51f0 100644 --- a/core/src/test/scala-3/cats/derived/InvariantSuite.scala +++ b/core/src/test/scala-3/cats/derived/InvariantSuite.scala @@ -17,6 +17,7 @@ package cats.derived import cats.Invariant +import cats.derived.Derived.<<< import cats.laws.discipline.* import cats.laws.discipline.arbitrary.* import cats.laws.discipline.eq.* @@ -105,7 +106,7 @@ object InvariantSuite: object strictInstances: given [T]: Invariant[Const[T]] = semiauto.invariant - given [F[_]: Invariant, G[_]: Invariant]: Invariant[[x] =>> F[G[x]]] = Invariant[F].compose[G] + given [F[_]: Invariant, G[_]: Invariant]: Invariant[F <<< G] = Invariant[F].compose[G] given [F[_]: Invariant, R]: Invariant[[x] =>> F[x => R]] = Invariant[F].compose[[x] =>> x => R] given Invariant[Snoc] = strict.semiauto.invariant given Invariant[GenericAdtF] = strict.semiauto.invariant diff --git a/core/src/test/scala-3/cats/derived/MonoidKSuite.scala b/core/src/test/scala-3/cats/derived/MonoidKSuite.scala index fa975d55..a8846405 100644 --- a/core/src/test/scala-3/cats/derived/MonoidKSuite.scala +++ b/core/src/test/scala-3/cats/derived/MonoidKSuite.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Applicative, Eval, Monoid, MonoidK} import cats.laws.discipline.{MonoidKTests, SerializableTests} import shapeless3.deriving.Const @@ -58,8 +59,8 @@ object MonoidKSuite: object strictInstances: given [T: Monoid]: MonoidK[Const[T]] = semiauto.monoidK - given [F[_]: MonoidK, G[_]]: MonoidK[[x] =>> F[G[x]]] = MonoidK[F].compose[G] - given [F[_]: Applicative, G[_]: MonoidK]: MonoidK[[x] =>> F[G[x]]] = semiauto.monoidK + given [F[_]: MonoidK, G[_]]: MonoidK[F <<< G] = MonoidK[F].compose[G] + given [F[_]: Applicative, G[_]: MonoidK]: MonoidK[F <<< G] = semiauto.monoidK given MonoidK[ComplexProduct] = strict.semiauto.monoidK given MonoidK[CaseClassWOption] = strict.semiauto.monoidK given MonoidK[BoxMul] = strict.semiauto.monoidK diff --git a/core/src/test/scala-3/cats/derived/NonEmptyAlternativeSuite.scala b/core/src/test/scala-3/cats/derived/NonEmptyAlternativeSuite.scala index 54c96684..97fb4856 100644 --- a/core/src/test/scala-3/cats/derived/NonEmptyAlternativeSuite.scala +++ b/core/src/test/scala-3/cats/derived/NonEmptyAlternativeSuite.scala @@ -16,6 +16,7 @@ package cats.derived +import cats.derived.Derived.<<< import cats.laws.discipline.* import cats.{Applicative, NonEmptyAlternative} import org.scalacheck.Arbitrary @@ -68,7 +69,7 @@ object NonEmptyAlternativeSuite: given NonEmptyAlternative[UnCons] = semiauto.nonEmptyAlternative object strictInstances: - given [F[_]: NonEmptyAlternative, G[_]: Applicative]: NonEmptyAlternative[[x] =>> F[G[x]]] = + given [F[_]: NonEmptyAlternative, G[_]: Applicative]: NonEmptyAlternative[F <<< G] = NonEmptyAlternative[F].compose[G] given NonEmptyAlternative[CaseClassWOption] = strict.semiauto.nonEmptyAlternative given NonEmptyAlternative[UnCons] = strict.semiauto.nonEmptyAlternative diff --git a/core/src/test/scala-3/cats/derived/NonEmptyTraverseSuite.scala b/core/src/test/scala-3/cats/derived/NonEmptyTraverseSuite.scala index 0ae107eb..9dc8347b 100644 --- a/core/src/test/scala-3/cats/derived/NonEmptyTraverseSuite.scala +++ b/core/src/test/scala-3/cats/derived/NonEmptyTraverseSuite.scala @@ -18,6 +18,7 @@ package cats.derived import cats.{Eq, NonEmptyTraverse, Traverse} import cats.data.{NonEmptyList, OneAnd} +import cats.derived.Derived.<<< import cats.laws.discipline.* import shapeless3.deriving.Const @@ -141,7 +142,7 @@ object NonEmptyTraverseSuite: object strictInstances: given [T]: Traverse[Const[T]] = semiauto.traverse - given [F[_]: Traverse, G[_]: Traverse]: Traverse[[x] =>> F[G[x]]] = Traverse[F].compose[G] + given [F[_]: Traverse, G[_]: Traverse]: Traverse[F <<< G] = Traverse[F].compose[G] given Traverse[IList] = strict.semiauto.traverse given Traverse[Snoc] = strict.semiauto.traverse given NonEmptyTraverse[ICons] = strict.semiauto.nonEmptyTraverse diff --git a/core/src/test/scala-3/cats/derived/ReducibleSuite.scala b/core/src/test/scala-3/cats/derived/ReducibleSuite.scala index d859be6a..4c7b8a2d 100644 --- a/core/src/test/scala-3/cats/derived/ReducibleSuite.scala +++ b/core/src/test/scala-3/cats/derived/ReducibleSuite.scala @@ -18,6 +18,7 @@ package cats.derived import cats.{Eval, Foldable, Reducible} import cats.data.{NonEmptyList, OneAnd} +import cats.derived.Derived.<<< import cats.laws.discipline.* import cats.syntax.all.given import shapeless3.deriving.Const @@ -94,7 +95,7 @@ object ReducibleSuite: object strictInstances: given [T]: Foldable[Const[T]] = semiauto.foldable - given [F[_]: Foldable, G[_]: Foldable]: Foldable[[x] =>> F[G[x]]] = Foldable[F].compose[G] + given [F[_]: Foldable, G[_]: Foldable]: Foldable[F <<< G] = Foldable[F].compose[G] given Foldable[IList] = strict.semiauto.foldable given Foldable[Snoc] = strict.semiauto.foldable given Reducible[ICons] = strict.semiauto.reducible diff --git a/core/src/test/scala-3/cats/derived/SemigroupKSuite.scala b/core/src/test/scala-3/cats/derived/SemigroupKSuite.scala index 217e41bf..2b789276 100644 --- a/core/src/test/scala-3/cats/derived/SemigroupKSuite.scala +++ b/core/src/test/scala-3/cats/derived/SemigroupKSuite.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Apply, Eval, Semigroup, SemigroupK} import cats.laws.discipline.{SemigroupKTests, SerializableTests} import shapeless3.deriving.Const @@ -56,8 +57,8 @@ object SemigroupKSuite: object strictInstances: given [T: Semigroup]: SemigroupK[Const[T]] = semiauto.semigroupK - given [F[_]: SemigroupK, G[_]]: SemigroupK[[x] =>> F[G[x]]] = SemigroupK[F].compose[G] - given [F[_]: Apply, G[_]: SemigroupK]: SemigroupK[[x] =>> F[G[x]]] = semiauto.semigroupK + given [F[_]: SemigroupK, G[_]]: SemigroupK[F <<< G] = SemigroupK[F].compose[G] + given [F[_]: Apply, G[_]: SemigroupK]: SemigroupK[F <<< G] = semiauto.semigroupK given SemigroupK[ComplexProduct] = strict.semiauto.semigroupK given SemigroupK[CaseClassWOption] = strict.semiauto.semigroupK given SemigroupK[BoxMul] = strict.semiauto.semigroupK diff --git a/core/src/test/scala-3/cats/derived/TraverseSuite.scala b/core/src/test/scala-3/cats/derived/TraverseSuite.scala index c4417433..01f2bea5 100644 --- a/core/src/test/scala-3/cats/derived/TraverseSuite.scala +++ b/core/src/test/scala-3/cats/derived/TraverseSuite.scala @@ -1,5 +1,6 @@ package cats.derived +import cats.derived.Derived.<<< import cats.{Eq, Traverse} import cats.laws.discipline.* import shapeless3.deriving.Const @@ -82,7 +83,7 @@ object TraverseSuite: object strictInstances: given [T]: Traverse[Const[T]] = semiauto.traverse - given [F[_]: Traverse, G[_]: Traverse]: Traverse[[x] =>> F[G[x]]] = Traverse[F].compose[G] + given [F[_]: Traverse, G[_]: Traverse]: Traverse[F <<< G] = Traverse[F].compose[G] given Traverse[Snoc] = strict.semiauto.traverse given Traverse[IList] = strict.semiauto.traverse given Traverse[Tree] = strict.semiauto.traverse