diff --git a/.scalafmt.conf b/.scalafmt.conf index 31c87fd5f7..d1f0fdc5cd 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version=3.4.0 +version=3.4.2 align.openParenCallSite = true align.openParenDefnSite = true maxColumn = 120 diff --git a/project/TupleBifunctorInstancesBoiler.scala b/project/TupleBifunctorInstancesBoiler.scala index e88baaf60a..9968001b44 100644 --- a/project/TupleBifunctorInstancesBoiler.scala +++ b/project/TupleBifunctorInstancesBoiler.scala @@ -19,13 +19,13 @@ object GenTupleBifunctorInstances extends Template { | |private[cats] trait NTupleBifunctorInstances { ${if (arity > 1) - block""" + block""" - implicit final def catsStdBifunctorForTuple$arity${`[A0, A(N - 2)]`}: Bifunctor[${`(A..N - 2, *, *)`}] = - new Bifunctor[${`(A..N - 2, *, *)`}] { - def bimap[A, B, C, D](fa: (${`A0, A(N - 2)`}A, B))(f: A => C, g: B => D): (${`A0, A(N - 2)`}C, D) = (${`fa._1..fa._(n - 2)`}f(fa._${arity - 1}), g(fa._$arity)) - }""" - else - block""" + else + block""" -"""} |}""" } diff --git a/project/TupleBitraverseInstancesBoiler.scala b/project/TupleBitraverseInstancesBoiler.scala index 4933d44f07..659b6952ba 100644 --- a/project/TupleBitraverseInstancesBoiler.scala +++ b/project/TupleBitraverseInstancesBoiler.scala @@ -19,7 +19,7 @@ object GenTupleBitraverseInstances extends Template { | |private[cats] trait NTupleBitraverseInstances { ${if (arity > 1) - block""" + block""" - implicit final def catsStdBitraverseForTuple$arity${`[A0, A(N - 2)]`}: Bitraverse[${`(A..N - 2, *, *)`}] = - new Bitraverse[${`(A..N - 2, *, *)`}] { - def bitraverse[G[_], A, B, C, D](fa: (${`A0, A(N - 2)`}A, B))(f: A => G[C], g: B => G[D])(implicit G: Applicative[G]): G[(${`A0, A(N - 2)`}C, D)] = @@ -29,8 +29,8 @@ ${if (arity > 1) - def bifoldRight[A, B, C](fa: (${`A0, A(N - 2)`}A, B), c: Eval[C])(f: (A, Eval[C]) => Eval[C], g: (B, Eval[C]) => Eval[C]): Eval[C] = - g(fa._$arity, f(fa._${arity - 1}, c)) - }""" - else - block""" + else + block""" -"""} |}""" } diff --git a/project/TupleMonadInstancesBoiler.scala b/project/TupleMonadInstancesBoiler.scala index 9bb4fa4360..9eaad8abc1 100644 --- a/project/TupleMonadInstancesBoiler.scala +++ b/project/TupleMonadInstancesBoiler.scala @@ -73,8 +73,8 @@ object GenTupleMonadInstances extends Template { |} |private[cats] sealed trait NTupleMonadInstances1 extends NTupleMonadInstances2 { - implicit final def catsStdCommutativeMonadForTuple$arity${`[A0, A(N - 1)]`}${`constraints A..(N-1)`( - "CommutativeMonoid" - )} + "CommutativeMonoid" + )} - : CommutativeMonad[${`(A..N - 1, *)`}] = - new FlatMapTuple$arity${`[A0, A(N - 1)]`}(${`A0, A(N - 1)`}) with CommutativeMonad[${`(A..N - 1, *)`}] { - def pure[A](a: A): ${`A0, A(N - 1)&`("A")} = $monadPureMethod @@ -82,8 +82,8 @@ object GenTupleMonadInstances extends Template { |} |private[cats] sealed trait NTupleMonadInstances2 extends NTupleMonadInstances3 { - implicit final def catsStdCommutativeFlatMapForTuple$arity${`[A0, A(N - 1)]`}${`constraints A..(N-1)`( - "CommutativeSemigroup" - )} + "CommutativeSemigroup" + )} - : CommutativeFlatMap[${`(A..N - 1, *)`}] = - new FlatMapTuple$arity${`[A0, A(N - 1)]`}(${`A0, A(N - 1)`}) with CommutativeFlatMap[${`(A..N - 1, *)`}] |} @@ -123,7 +123,7 @@ object GenTupleMonadInstances extends Template { - val xb = f(fa._$arity) - ${`combine A..(N - 1)`("fa", "xb", s"xb._$arity")} """ - else block""" + else block""" - f(fa._1) """} - } @@ -149,7 +149,7 @@ object GenTupleMonadInstances extends Template { - case (${`a0, a(n - 1)`}, Right(b)) => (${`a0, a(n - 1)`}, b) - case (${`a0, a(n - 1)`}, Left(nextA)) => loop((${`a0, a(n - 1)`}), nextA) """ - else block""" + else block""" - def loop(aa: A): Tuple1[B] = - f(aa) match { - case Tuple1(Right(b)) => Tuple1(b) diff --git a/tests/src/test/scala/cats/tests/TupleSuite.scala b/tests/src/test/scala/cats/tests/TupleSuite.scala index fd44dfc50b..38c27e023a 100644 --- a/tests/src/test/scala/cats/tests/TupleSuite.scala +++ b/tests/src/test/scala/cats/tests/TupleSuite.scala @@ -228,9 +228,9 @@ class TupleSuite extends CatsSuite { assert((foo1, bar1).show === s"(${Show[Foo].show(foo1)},${Show[Bar].show(bar1)})") assert((foo1, bar1, baz1).show === s"(${Show[Foo].show(foo1)},${Show[Bar].show(bar1)},${Show[Baz].show(baz1)})") assert((foo1, bar1, baz1, foo2, bar2, baz2).show === s"(${Show[Foo].show(foo1)},${Show[Bar].show(bar1)},${Show[Baz] - .show(baz1)},${Show[Foo].show(foo2)},${Show[Bar].show(bar2)},${Show[Baz].show(baz2)})") + .show(baz1)},${Show[Foo].show(foo2)},${Show[Bar].show(bar2)},${Show[Baz].show(baz2)})") assert((foo1, bar1, baz1, foo2, bar2, baz2, foo3, bar3, baz3).show === s"(${Show[Foo].show(foo1)},${Show[Bar] - .show(bar1)},${Show[Baz].show(baz1)},${Show[Foo].show(foo2)},${Show[Bar].show(bar2)},${Show[Baz] - .show(baz2)},${Show[Foo].show(foo3)},${Show[Bar].show(bar3)},${Show[Baz].show(baz3)})") + .show(bar1)},${Show[Baz].show(baz1)},${Show[Foo].show(foo2)},${Show[Bar].show(bar2)},${Show[Baz] + .show(baz2)},${Show[Foo].show(foo3)},${Show[Bar].show(bar3)},${Show[Baz].show(baz3)})") } }