-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Optimize Alternative
(part 4): add prependK
/appendK
specializations for Cats monad transformers
#4299
base: main
Are you sure you want to change the base?
Optimize Alternative
(part 4): add prependK
/appendK
specializations for Cats monad transformers
#4299
Conversation
The PR is created as "Draft" because this work was done quite a long ago and I just want to make sure I didn't lose something after lots of merges and rebases. But perhaps it is good to go already. |
bcc20ee
to
5d7b27d
Compare
5d7b27d
to
84e4788
Compare
I've made a deep inhale and re-reviewed the changes here. I would say they look good to me and seems all the tests and Mima checks are happy as well. So I would dare to claim the PR is ready to go) |
84e4788
to
6f16d4b
Compare
Alternative
(part 4): add prependK
/appendK
specializations for Cats monad transformers
e8a4d0e
to
0d3d11d
Compare
e2d015c
to
fbb3510
Compare
I think that all the concerns have been addressed here. Could you take one more look please? |
Sorry, haven't forgotten. Rather than "one more look" it needs "one proper look" actually 😅 |
fbb3510
to
7c0f6b1
Compare
private trait RWSTAlternative1[F[_], E, L, S] | ||
private trait RWSTNonEmptyAlternative1[F[_], E, L, S] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I missed it. Did we add law tests for this instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, no worries, here they are:
trait NonEmptyAlternativeLaws[F[_]] extends ApplicativeLaws[F] with SemigroupKLaws[F] { |
trait NonEmptyAlternativeTests[F[_]] extends ApplicativeTests[F] with SemigroupKTests[F] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I mean specifically for the IndexedReaderWriterStateT
instance of NonEmptyAlternative
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accordingly, AlternativeLaws
and AlternativeTests
were changed to extend NonEmptyAlternative*
:
trait AlternativeLaws[F[_]] extends NonEmptyAlternativeLaws[F] with MonoidKLaws[F] { |
trait AlternativeTests[F[_]] extends NonEmptyAlternativeTests[F] with MonoidKTests[F] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@armanbilge is it what you're asking about?
cats/tests/shared/src/test/scala/cats/tests/IndexedReaderWriterStateTSuite.scala
Lines 451 to 466 in f2d871c
{ | |
implicit val G: Monad[ListWrapper] = ListWrapper.monad | |
val SA = IRWST.catsDataAlternativeForIRWST[ListWrapper, Boolean, String, MiniInt](ListWrapper.monad, | |
ListWrapper.alternative, | |
Monoid[String] | |
) | |
checkAll( | |
"IndexedReaderWriterStateT[ListWrapper, String, String, Int, Int, *]", | |
AlternativeTests[IRWST[ListWrapper, Boolean, String, MiniInt, MiniInt, *]](SA).alternative[Int, Int, Int] | |
) | |
checkAll("Alternative[IndexedReaderWriterStateT[ListWrapper, String, String, Int, Int, *]]", | |
SerializableTests.serializable(SA) | |
) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That part of tests was not changed, though, iirc – it included tests for NonEmptyAlternativeLaws automatically due to the inheritance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks. I was asking, because for the other instances you added tests using ListWrapper.nonEmptyAlternative
in addition to existing tests using the ListWrapper.alternative
, as far as I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I see... That's a fair concern.. And honestly, I don't remember why. There are three causes possible:
- I simply forgot to add it.
- I lost it after a series of successive rebases.
- Most likely, little green men came and stole that piece of code from the repo.
But I think, despite of the cause, it makes sense to return it back.
7c0f6b1
to
18de9a4
Compare
@armanbilge I added direct
|
18de9a4
to
5315b2a
Compare
1f458ad
to
8143774
Compare
629ba67
to
5e5964b
Compare
5e5964b
to
e33482c
Compare
e33482c
to
62328f1
Compare
693a260
to
7bd1e77
Compare
7bd1e77
to
19480c7
Compare
e76a758
to
7b6c56a
Compare
7b6c56a
to
c0c2033
Compare
c0c2033
to
2d5208b
Compare
871b775
to
1fc1b52
Compare
Nowadays, there's a lot of hype on AI technologies around – lots of people try to ruminate on what the AI can or cannot do and how it can be useful or even dangerous to all of us. I personally think though, that at least one of the things that the AI could really help with – is to review such huge and boring PRs like this one. |
1fc1b52
to
f341ab7
Compare
f341ab7
to
dfa64db
Compare
Sorry I dropped the ball on reviewing this 😢 also I think your force-pushes erased my review progress 😅 |
Hi, @armanbilge, @johnynek , |
Adds optimized specializations for the new
prependK
/appendK
methods introduced in the initial PR (#4014).Previous PRs:
Alternative
(part 3): addprependK
/appendK
specializations for Cats NE wrappers #4055