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

I1061 part 1 - renames in std package #1066

Merged
merged 5 commits into from
May 30, 2016
Merged

Conversation

kailuowang
Copy link
Contributor

No description provided.

@@ -14,37 +14,37 @@ trait AnyValInstances
with TupleInstances

trait IntInstances extends cats.kernel.std.IntInstances {
implicit val intShow: Show[Int] = Show.fromToString[Int]
implicit val catsShowForcatsForInt: Show[Int] = Show.fromToString[Int]
Copy link
Contributor

Choose a reason for hiding this comment

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

You might have gone a little overboard here ;)

Copy link

Choose a reason for hiding this comment

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

catsShowForcatsForInt => catsShowForInt

@@ -23,7 +23,7 @@ trait EitherInstances extends EitherInstances1 {
}
}

implicit def eitherInstances[A]: Monad[Either[A, ?]] with Traverse[Either[A, ?]] =
implicit def catsMonadForEither[A]: Monad[Either[A, ?]] with Traverse[Either[A, ?]] =
Copy link
Contributor

Choose a reason for hiding this comment

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

For this and several other instances you've somewhat arbitrarily picked the first first type class when an instanced provides several type classes. This may not be a big deal and I don't think I really have a better suggestion, but it does feel a little off.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see, I used a regex replace, so it inherited the original name which didn't have the Traverse in it. I meant to have all typeclass in it though as I did with several manual replacement. updated

Copy link
Contributor

Choose a reason for hiding this comment

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

There's probably no single good solution here, but I think that including all of the type class names in the implicit name has its issues too. Changing the name of these implicits breaks binary compatibility. Ideally we could make an implicit extend another type class without breaking binary compatibility but then we wouldn't have the new type class in the name.

Copy link
Contributor

@ceedubs ceedubs May 27, 2016

Choose a reason for hiding this comment

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

@larsrh do you have any thoughts on this? You did a really good job of maintaining binary compatibility in scalaz, and I'd imagine this sort of thing came up.

edit: or @xuwei-k for the same reason

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I thought about using a name like catsInstancesForXXX but it might conflict with cats.kernel

Copy link

Choose a reason for hiding this comment

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

As per #1061 (comment), perhaps the full package name should be incuded? So here, cats => catsStd. An then catsKernel, catsKernelStd and so on

Copy link
Contributor

Choose a reason for hiding this comment

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

@ceedubs I don't recall any situation where this sort of thing came up. Having said that, I now wonder whether these instances are necessarily orphan, or whether we can come up with a non-orphan encoding which doesn't duplicate code all over the place. (If they were not orphan this problem wouldn't have existed in the first place.)

@kailuowang
Copy link
Contributor Author

I am fixing the build. Also if no objection I am going to implement @inthenow 's suggestion ( full package name). for instances with multiple typeclasses I am just going to name them with catsStdInstancesForXxxxx

@codecov-io
Copy link

codecov-io commented May 27, 2016

Current coverage is 88.37%

Merging #1066 into master will not change coverage

@@             master      #1066   diff @@
==========================================
  Files           215        215          
  Lines          2743       2743          
  Methods        2689       2689          
  Messages          0          0          
  Branches         49         49          
==========================================
  Hits           2424       2424          
  Misses          319        319          
  Partials          0          0          

Sunburst

Powered by Codecov. Last updated by 8717aeb...495bff7

@non
Copy link
Contributor

non commented May 27, 2016

This is great, thanks!

Can you also update the names in project/Boilerplate.scala and project/KernelBoiler.scala too?

@kailuowang
Copy link
Contributor Author

@non I updated the kernelBoilerplate and cats.kernel.std but didn’t find implicit defs in the templates inproject/Boilerplate ? Do you mind point me to the specific location?

@non
Copy link
Contributor

non commented May 30, 2016

@kailuowang I was wrong. It looks like you got them all! Thanks! 👍

@ceedubs
Copy link
Contributor

ceedubs commented May 30, 2016

👍

@non non merged commit b926e69 into typelevel:master May 30, 2016
@ceedubs ceedubs mentioned this pull request Jun 3, 2016
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.

5 participants