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

Added commutative apply and applicative to Const #2204

Merged
merged 5 commits into from
Mar 24, 2018
Merged

Added commutative apply and applicative to Const #2204

merged 5 commits into from
Mar 24, 2018

Conversation

barambani
Copy link
Contributor

@barambani barambani commented Mar 20, 2018

This addresses the issue #2201

@barambani
Copy link
Contributor Author

Insufficient memory, but the changes should pass tests and MiMa

@barambani
Copy link
Contributor Author

Could it be possible to run the CI on this again ? Thanks.

@codecov-io
Copy link

codecov-io commented Mar 20, 2018

Codecov Report

Merging #2204 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2204   +/-   ##
=======================================
  Coverage   94.83%   94.83%           
=======================================
  Files         333      333           
  Lines        5789     5789           
  Branches      222      211   -11     
=======================================
  Hits         5490     5490           
  Misses        299      299
Impacted Files Coverage Δ
core/src/main/scala/cats/data/Const.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 d965bbf...4a1b431. Read the comment docs.


{
implicit val setMonoid: CommutativeMonoid[Int] =
Copy link
Member

Choose a reason for hiding this comment

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

Should we name this intCommutativeMonoid instead, maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ops ... fixing it 👍


{
implicit val setMonoid: CommutativeSemigroup[Int] =
Copy link
Member

Choose a reason for hiding this comment

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

Rename this too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixing this as well, thanks


{
implicit val intCommutativeMonoid: CommutativeMonoid[Int] =
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of defining this instance just for this test, I think that you should be able to use CMono from Helpers.scala. You can see an example of it being used in FunctionSuite.scala. Similarly for the commutative semigroup below (CSemi).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, I will change it 👍


{
implicit val iso = SemigroupalTests.Isomorphisms.invariant[Const[CSemi, ?]](Const.catsDataFunctorForConst)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this iso needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

obviously not 😄 . Thanks for this review. It's amazing to have your help.

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 can't understand where the Invariant[Const[CSemi, ?]] comes from though. If is not too long, could you explain me why I have in scope that one but not Invariant[Const[CMono, ?]] ? Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

To be honest I'm not familiar with why these SemigroupalTests.Isomorphism.invariants are needed in some tests. Maybe someone else can provide insight there. I wasn't sure why it was needed so I tried removing it in both cases and one of them still compiled ¯\_(ツ)_/¯

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot 👍

@ceedubs
Copy link
Contributor

ceedubs commented Mar 23, 2018

Thanks a lot, @barambani! One minor remaining question and then this looks good to me.

@barambani
Copy link
Contributor Author

I will fix it. Thank you for the time you spend on this. 👍

Copy link
Contributor

@ceedubs ceedubs left a comment

Choose a reason for hiding this comment

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

👍 thanks , @barambani!

Copy link
Member

@LukaJCB LukaJCB left a comment

Choose a reason for hiding this comment

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

Thanks very much! :)

@barambani
Copy link
Contributor Author

Thank you both 😄

@kailuowang kailuowang added this to the 1.2 milestone May 30, 2018
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.

5 participants