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

Simplify module structure and introduce alleycats-retry #132

Merged
merged 4 commits into from Dec 13, 2019
Merged

Conversation

LukaJCB
Copy link
Collaborator

@LukaJCB LukaJCB commented Dec 5, 2019

This pulls the cats-effect instance into core and moves the Future, Id and Eval instances to alleycats-retry. It also removes the monix module, since it's already covered by Timer. :)

@LukaJCB LukaJCB requested a review from cb372 December 5, 2019 16:03
@LukaJCB
Copy link
Collaborator Author

LukaJCB commented Dec 5, 2019

Should probably release a new major version after this and #131 (if we decide on merging this).

build.sbt Outdated
crossScalaVersions := scalaVersions,
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "cats-effect" % "2.0.0",
Copy link
Owner

Choose a reason for hiding this comment

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

catsEffectVersion

@cb372
Copy link
Owner

cb372 commented Dec 12, 2019

I had a quick look at the Maven Central download stats for last month (not a very accurate measure of how the lib is actually being used, but it's the only data we have). Combining Scala 2.11, 2.12 and 2.13 and JVM/JS:

  • cats-retry-core = 6,300
  • cats-retry-cats-effect = 5,410

So, with the caveat that we can't really be sure what these numbers mean, they could be interpreted to say that around 85% of people who use cats-retry use it with cats-effect.

Given that, I think it's reasonable to promote cats-effect to a core dependency and demote Id and Future to second-class citizens.

Also +1 for removing the Monix module. As Monix is based on cats-effect it doesn't need any special integration.

The `alleycats-retry` module provides instances for `cats.Id`, `cats.Eval` and `Future` that
simply do a `Thread.sleep(...)`.

To use them, simply import `retry.alleycats.instances`:
Copy link
Owner

Choose a reason for hiding this comment

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

The import is missing a ._ on the end.

Also let's include a line here showing how to add a dependency on the alleycats module. It's a bit of a mouthful:

```scala mdoc:passthrough
println(
  s"""
  |```
  |libraryDependencies += "com.github.cb372" %% "alleycats-retry" % "${retry.BuildInfo.version.replaceFirst("\\+.*", "")}"
  |```
  |""".stripMargin.trim
)

@@ -148,10 +144,6 @@ val root = project
.aggregate(
coreJVM,
coreJS,
catsEffectJVM,
Copy link
Owner

Choose a reason for hiding this comment

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

Shouldn't we aggregate alleycatsJVM and alleycatsJS here?

@@ -67,9 +68,13 @@ val core = crossProject(JVMPlatform, JSPlatform)
.in(file("modules/core"))
.settings(moduleSettings)
.settings(
name := "cats-retry",
Copy link
Owner

Choose a reason for hiding this comment

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

This will set the module name to cats-retry-cats-retry 😄

Let's remove the moduleName := ... line from moduleSettings above.

@@ -98,8 +98,6 @@ import cats.effect.Timer
import scala.concurrent.ExecutionContext.global
Copy link
Owner

Choose a reason for hiding this comment

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

Please update the instructions higher up in this file on how to add the dependency in sbt. The cats-effect module is going away and the cats-retry-core module is changing name to just cats-retry (right?).

By the way that change of artifact name is going to mess with scala-steward. That's a shame, but not much we can do about it. We could publish a duplicate artifact as cats-retry-core, but we wouldn't want to do that forever. Eventually people will need to migrate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We're pushing some breaking changes, so it's not the worst thing :)

@LukaJCB
Copy link
Collaborator Author

LukaJCB commented Dec 12, 2019

Thanks for the review! :) I'll probably get to this tomorrow

Copy link
Owner

@cb372 cb372 left a comment

Choose a reason for hiding this comment

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

Looks good! Just needs a rebase to add those changes to the Sleep instance for Future.

@LukaJCB LukaJCB merged commit 91b7d9a into master Dec 13, 2019
@LukaJCB LukaJCB deleted the simplify branch December 13, 2019 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants