Skip to content

Commit 99b543b

Browse files
authored
Deprecate CartesianBuilder, finish up #1487 (#1745)
* Apply syntax for tuples, fixes #1363 * fix feedback and build error
1 parent 44021d6 commit 99b543b

File tree

20 files changed

+66
-89
lines changed

20 files changed

+66
-89
lines changed

.jvmopts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
# see https://weblogs.java.net/blog/kcpeppe/archive/2013/12/11/case-study-jvm-hotspot-flags
21
-Dfile.encoding=UTF8
32
-Xms1G
43
-Xmx6G
54
-XX:MaxPermSize=512M
65
-XX:ReservedCodeCacheSize=250M
76
-XX:+TieredCompilation
87
-XX:-UseGCOverheadLimit
9-
# effectively adds GC to Perm space
108
-XX:+CMSClassUnloadingEnabled
11-
# must be enabled for CMSClassUnloadingEnabled to work
129
-XX:+UseConcMarkSweepGC

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ lazy val commonJsSettings = Seq(
6767
scalaJSStage in Global := FastOptStage,
6868
parallelExecution := false,
6969
requiresDOM := false,
70-
jsEnv := NodeJSEnv().value,
70+
jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv(),
7171
// Only used for scala.js for now
7272
botBuild := scala.sys.env.get("TRAVIS").isDefined,
7373
// batch mode decreases the amount of memory needed to compile scala.js code

core/src/main/scala/cats/data/EitherT.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ final case class EitherT[F[_], A, B](value: F[Either[A, B]]) {
175175
* scala> val v1: Validated[NonEmptyList[Error], Int] = Validated.invalidNel("error 1")
176176
* scala> val v2: Validated[NonEmptyList[Error], Int] = Validated.invalidNel("error 2")
177177
* scala> val eithert: EitherT[Option, Error, Int] = EitherT.leftT[Option, Int]("error 3")
178-
* scala> eithert.withValidated { v3 => (v1 |@| v2 |@| v3.toValidatedNel).map { case (i, j, k) => i + j + k } }
178+
* scala> eithert.withValidated { v3 => (v1, v2, v3.toValidatedNel).mapN { case (i, j, k) => i + j + k } }
179179
* res0: EitherT[Option, NonEmptyList[Error], Int] = EitherT(Some(Left(NonEmptyList(error 1, error 2, error 3))))
180180
* }}}
181181
*/

core/src/main/scala/cats/data/OneAnd.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,10 @@ private[data] trait OneAndLowPriority3 extends OneAndLowPriority2 {
229229
implicit def catsDataNonEmptyTraverseForOneAnd[F[_]](implicit F: Traverse[F], F2: MonadCombine[F]): NonEmptyTraverse[OneAnd[F, ?]] =
230230
new NonEmptyReducible[OneAnd[F, ?], F] with NonEmptyTraverse[OneAnd[F, ?]] {
231231
def nonEmptyTraverse[G[_], A, B](fa: OneAnd[F, A])(f: (A) => G[B])(implicit G: Apply[G]): G[OneAnd[F, B]] = {
232-
import cats.syntax.cartesian._
232+
import cats.syntax.apply._
233233

234234
fa.map(a => Apply[G].map(f(a))(OneAnd(_, F2.empty[B])))(F)
235-
.reduceLeft(((acc, a) => (acc |@| a).map((x: OneAnd[F, B], y: OneAnd[F, B]) => x.combine(y))))
235+
.reduceLeft(((acc, a) => (acc, a).mapN((x: OneAnd[F, B], y: OneAnd[F, B]) => x.combine(y))))
236236
}
237237

238238

core/src/main/scala/cats/data/Tuple2K.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package cats
22
package data
33

44
import cats.functor.Contravariant
5-
import cats.syntax.cartesian._
65

76
/**
87
* [[Tuple2K]] is a product to two independent functor values.
@@ -159,8 +158,8 @@ private[data] sealed trait Tuple2KTraverse[F[_], G[_]] extends Traverse[λ[α =>
159158
def F: Traverse[F]
160159
def G: Traverse[G]
161160

162-
override def traverse[H[_]: Applicative, A, B](fa: Tuple2K[F, G, A])(f: A => H[B]): H[Tuple2K[F, G, B]] =
163-
(F.traverse(fa.first)(f) |@| G.traverse(fa.second)(f)).map(Tuple2K(_, _))
161+
override def traverse[H[_], A, B](fa: Tuple2K[F, G, A])(f: A => H[B])(implicit H: Applicative[H]): H[Tuple2K[F, G, B]] =
162+
H.map2(F.traverse(fa.first)(f), G.traverse(fa.second)(f))(Tuple2K(_, _))
164163
}
165164

166165
private[data] sealed trait Tuple2KMonadCombine[F[_], G[_]] extends MonadCombine[λ[α => Tuple2K[F, G, α]]]

core/src/main/scala/cats/syntax/all.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ trait AllSyntax
4343
with TraverseFilterSyntax
4444
with TraverseSyntax
4545
with NonEmptyTraverseSyntax
46-
with TupleSyntax
4746
with ValidatedSyntax
4847
with VectorSyntax
4948
with WriterSyntax

core/src/main/scala/cats/syntax/apply.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package cats
22
package syntax
33

4-
trait ApplySyntax {
4+
trait ApplySyntax extends TupleCartesianSyntax {
55
implicit final def catsSyntaxApply[F[_], A](fa: F[A])(implicit F: Apply[F]): Apply.Ops[F, A] =
66
new Apply.Ops[F, A] {
77
val self = fa

core/src/main/scala/cats/syntax/cartesian.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ trait CartesianSyntax {
1010
}
1111

1212
abstract class CartesianOps[F[_], A] extends Cartesian.Ops[F, A] {
13+
14+
@deprecated("Replaced by an apply syntax, e.g. instead of (a |@| b).map(...) use (a, b).mapN(...)", "1.0.0-MF")
1315
final def |@|[B](fb: F[B]): CartesianBuilder[F]#CartesianBuilder2[A, B] =
1416
new CartesianBuilder[F] |@| self |@| fb
1517

core/src/main/scala/cats/syntax/package.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ package object syntax {
4343
object traverse extends TraverseSyntax
4444
object nonEmptyTraverse extends NonEmptyTraverseSyntax
4545
object traverseFilter extends TraverseFilterSyntax
46-
object tuple extends TupleSyntax
4746
object validated extends ValidatedSyntax
4847
object vector extends VectorSyntax
4948
object writer extends WriterSyntax

core/src/main/scala/cats/syntax/tuple.scala

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)