Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate CartesianBuilder, finish up #1487 #1745

Merged

Conversation

kailuowang
Copy link
Contributor

@kailuowang kailuowang commented Jun 27, 2017

This PR is to finish up #1487. I deprecated the CartesianBuilder, merged the master and one small correction in the build file.

@@ -67,7 +67,7 @@ lazy val commonJsSettings = Seq(
scalaJSStage in Global := FastOptStage,
parallelExecution := false,
requiresDOM := false,
jsEnv := NodeJSEnv().value,
jsEnv := new org.scalajs.jsenv.nodejs.NodeJSEnv(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old one is deprecated.

-XX:+CMSClassUnloadingEnabled
# must be enabled for CMSClassUnloadingEnabled to work
Copy link
Contributor Author

@kailuowang kailuowang Jun 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DavidGregory084 pointed out that these comments causes problem on Windows.

@@ -175,7 +175,7 @@ final case class EitherT[F[_], A, B](value: F[Either[A, B]]) {
* scala> val v1: Validated[NonEmptyList[Error], Int] = Validated.invalidNel("error 1")
* scala> val v2: Validated[NonEmptyList[Error], Int] = Validated.invalidNel("error 2")
* scala> val eithert: EitherT[Option, Error, Int] = EitherT.leftT[Option, Int]("error 3")
* scala> eithert.withValidated { v3 => (v1 |@| v2 |@| v3.toValidatedNel).map { case (i, j, k) => i + j + k } }
* scala> eithert.withValidated { v3 => (v1, v2, v3.leftMap(NonEmptyList.of(_))).mapN { case (i, j, k) => i + j + k } }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can keep the toValidatedNel (instead of .leftMap(NonEmptyList.of(_)))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missed that during the merge. will fix.

@@ -160,7 +160,7 @@ private[data] sealed trait Tuple2KTraverse[F[_], G[_]] extends Traverse[λ[α =>
def G: Traverse[G]

override def traverse[H[_]: Applicative, A, B](fa: Tuple2K[F, G, A])(f: A => H[B]): H[Tuple2K[F, G, B]] =
(F.traverse(fa.first)(f) |@| G.traverse(fa.second)(f)).map(Tuple2K(_, _))
(F.traverse(fa.first)(f), G.traverse(fa.second)(f)).mapN(Tuple2K(_, _))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can just write H.map2 instead of the syntax version?

Copy link
Collaborator

@peterneyens peterneyens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason we call it "cartesian tuple syntax", but put it under the cats.syntax.apply._ import?

@kailuowang
Copy link
Contributor Author

@johnynek please allow me to reply you here since any further change is probably going to be through this PR. I think @non first suggested the possibility of deprecating the |@| syntax once the tuple syntax is proven here. There wasn't any objections ATM. The cartesian syntax on tuple has been released since 0.7.0 for almost a year, I think it's about time to deprecate the |@| syntax. Unlike Xor, this change should be rather straightforward and mechanical (I just did it in cats code base, took me 10 minutes). If we still want to keep it, for how long?

@codecov-io
Copy link

codecov-io commented Jun 27, 2017

Codecov Report

Merging #1745 into master will decrease coverage by 0.02%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1745      +/-   ##
=========================================
- Coverage   94.02%     94%   -0.03%     
=========================================
  Files         256     256              
  Lines        4201    4201              
  Branches       84      89       +5     
=========================================
- Hits         3950    3949       -1     
- Misses        251     252       +1
Impacted Files Coverage Δ
core/src/main/scala/cats/syntax/apply.scala 100% <ø> (ø) ⬆️
core/src/main/scala/cats/syntax/cartesian.scala 50% <ø> (-25%) ⬇️
core/src/main/scala/cats/data/EitherT.scala 96.52% <ø> (ø) ⬆️
core/src/main/scala/cats/data/OneAnd.scala 98.36% <100%> (ø) ⬆️
core/src/main/scala/cats/data/Tuple2K.scala 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 605e9b5...9656199. Read the comment docs.

@johnynek
Copy link
Contributor

Okay. Thanks for linking to the relevant discussion.

@kailuowang
Copy link
Contributor Author

@peterneyens I think I addressed all your comments, have time to take another look?

@kailuowang kailuowang added this to the 1.0.0-MF milestone Jun 29, 2017
@kailuowang
Copy link
Contributor Author

kailuowang commented Jul 2, 2017

merge with 2 sign-offs given this has been discussed in depth in the previous related PRs.

@kailuowang kailuowang merged commit 99b543b into typelevel:master Jul 2, 2017
@kailuowang kailuowang deleted the DavidGregory084-tuple-unapply branch July 2, 2017 22:43
@fosskers
Copy link
Contributor

fosskers commented Jul 7, 2017

If |@| is being deprecated, is the tuple thing the new recommended syntax for Applicative-style?

@kailuowang
Copy link
Contributor Author

kailuowang commented Jul 7, 2017

@fosskers yes. I gave an example in the migration doc. Let me know if that works for you. https://github.com/kailuowang/cats/blob/8df835fe4700455135140c2e3d02b6555328985c/CHANGES.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants