Clean up ReaderWriterStateT#1706
Merged
Merged
Conversation
- Check if type class instances are serializable - Move Arbitrary instance to cats-laws - Move unamibiguous type class instances
peterneyens
commented
May 27, 2017
| flatMap { a => | ||
| rwsb.map { b => | ||
| fn(a, b) | ||
| } |
Contributor
Author
There was a problem hiding this comment.
You can get the same from Apply#map2
The version from Apply#map2 would look like :
map(flatMap(fa)(a => map(fb)(b => (a, b)))) { case (a, b) => f(a, b) }If we want the simpler implementation used here in RWST, we could override map2 in FlatMap.
peterneyens
commented
May 27, 2017
|
|
||
| // check serializable using Option | ||
| checkAll("MonadReader[ReaderWriterStateT[Option, String, Int, String, ?], String]", | ||
| SerializableTests.serializable(MonadReader[ReaderWriterStateT[Option, String, Int, String, ?], String])) |
Contributor
Author
There was a problem hiding this comment.
If I used ListWrapper here I got
Message: cannot assign instance of scala.collection.immutable.List$SerializationProxy to field cats.tests.ListWrapper.list of type scala.collection.immutable.List in instance of cats.tests.ListWrapper
So I used Option like the analogous test for Kleisli.
Codecov Report
@@ Coverage Diff @@
## master #1706 +/- ##
==========================================
- Coverage 93.96% 93.95% -0.01%
==========================================
Files 241 241
Lines 4091 4089 -2
Branches 160 156 -4
==========================================
- Hits 3844 3842 -2
Misses 247 247
Continue to review full report at Codecov.
|
Contributor
|
Thanks for doing this @peterneyens! I agree we should address these before 1.0.0-MF |
26 tasks
djspiewak
approved these changes
May 31, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I also find the ordering of the type parameters a bit confusing. Now it is
E(Reader) ->S(State) ->L(Writer), while the nameReaderWriterStateTsuggests thatWritercomes beforeState. The reason is probably theBifunctorinstance for theWriterpart.I would drop the
Bifunctorinstance and switch the order ofSandLso it aligns with the name. We could also leave as it is or change toReaderStateWriterT😃. If we want to change something, it should probably be done before 1.0.0-MF. Opinions?