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

SemigroupK sum: F[A], F[B] => F[A Either B] #3124

Merged
merged 7 commits into from
Nov 5, 2019
Merged

Conversation

pk044
Copy link
Contributor

@pk044 pk044 commented Nov 4, 2019

Closes #3112

@codecov-io
Copy link

codecov-io commented Nov 4, 2019

Codecov Report

Merging #3124 into master will increase coverage by 0.06%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3124      +/-   ##
==========================================
+ Coverage   93.17%   93.23%   +0.06%     
==========================================
  Files         372      375       +3     
  Lines        7182     7292     +110     
  Branches      199      194       -5     
==========================================
+ Hits         6692     6799     +107     
- Misses        490      493       +3
Flag Coverage Δ
#scala_version_212 93.54% <ø> (+0.01%) ⬆️
#scala_version_213 90.87% <ø> (+0.02%) ⬆️
Impacted Files Coverage Δ
core/src/main/scala/cats/SemigroupK.scala 100% <ø> (ø) ⬆️
core/src/main/scala/cats/instances/option.scala 98.14% <0%> (-1.86%) ⬇️
core/src/main/scala/cats/data/Chain.scala 99.05% <0%> (-0.63%) ⬇️
core/src/main/scala/cats/instances/list.scala 100% <0%> (ø) ⬆️
core/src/main/scala/cats/data/Const.scala 100% <0%> (ø) ⬆️
core/src/main/scala/cats/data/Validated.scala 100% <0%> (ø) ⬆️
...src/main/scala-2.13+/cats/instances/lazyList.scala 100% <0%> (ø) ⬆️
core/src/main/scala/cats/instances/vector.scala 100% <0%> (ø) ⬆️
core/src/main/scala/cats/instances/either.scala 100% <0%> (ø) ⬆️
... and 11 more

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 134570b...0b7aef6. Read the comment docs.

LukaJCB
LukaJCB previously approved these changes Nov 4, 2019
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.

Thank you! :)

* {{{
* scala> import cats.SemigroupK
* scala> import cats.data.NonEmptyList
* scala> SemigroupK[NonEmptyList].sum(NonEmptyList.one(1), NonEmptyList.one(2))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is nitpicky, but what do you think about using different types for this example? Otherwise looks good to me.

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 was hesitant about using NonEmptyList here, but I wasn't sure about the alternatives either, so I stayed with NEL.

do you perhaps have any suggestions which type could be used here instead? :)

Copy link
Contributor

Choose a reason for hiding this comment

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

@pk044 Oh, sorry, that wasn't very clear. I think NonEmptyList is a good choice, just that using different values for A and B might make it a little clearer—e.g. something like:

SemigroupK[NonEmptyList].sum(NonEmptyList.one("abc"), NonEmptyList.one(2))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, i changed the value 👍

@travisbrown travisbrown added this to the 2.1.0-RC1 milestone Nov 5, 2019
@LukaJCB LukaJCB merged commit 6d191a5 into typelevel:master Nov 5, 2019
gagandeepkalra added a commit to gagandeepkalra/cats that referenced this pull request Feb 16, 2020
travisbrown pushed a commit that referenced this pull request Feb 19, 2020
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.

Add sum: (F[A], F[B]) => F[A Either B]
4 participants