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

MonadTrans instance for RWST and make MonadTrans serializable #1680

Merged
merged 2 commits into from
May 18, 2017

Conversation

wedens
Copy link
Contributor

@wedens wedens commented May 18, 2017

No description provided.

@@ -344,6 +344,13 @@ class ReaderWriterStateTTests extends CatsSuite {
checkAll("ReaderWriterStateT[ListWrapper, String, Int, String, Int]",
SemigroupKTests[ReaderWriterStateT[ListWrapper, String, Int, String, ?]].semigroupK[Int])
}

{
implicit def F = ListWrapper.monad
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: I think that this could be a val instead of a def.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

copy/pasted it from some code above, so it's not the only place where it should be fixed :)

@@ -235,7 +235,7 @@ class StateTTests extends CatsSuite {

checkAll("StateT[ListWrapper, Int, Int]", MonadTests[StateT[ListWrapper, Int, ?]].monad[Int, Int, Int])
checkAll("Monad[StateT[ListWrapper, Int, ?]]", SerializableTests.serializable(Monad[StateT[ListWrapper, Int, ?]]))
checkAll("MonadTrans[EitherT[?[_], String, ?]]", MonadTransTests[EitherT[?[_], String, ?]].monadTrans[ListWrapper, Int, Int])
checkAll("MonadTrans[StateT[?[_], Int, ?]]", MonadTransTests[StateT[?[_], String, ?]].monadTrans[ListWrapper, Int, Int])
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops good catch!

@@ -344,6 +344,13 @@ class ReaderWriterStateTTests extends CatsSuite {
checkAll("ReaderWriterStateT[ListWrapper, String, Int, String, Int]",
SemigroupKTests[ReaderWriterStateT[ListWrapper, String, Int, String, ?]].semigroupK[Int])
}

{
implicit def F = ListWrapper.monad
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be checking the serialization laws here too?

@ceedubs
Copy link
Contributor

ceedubs commented May 18, 2017

Wow that was fast. Thanks @wedens!

Copy link
Contributor

@kailuowang kailuowang left a comment

Choose a reason for hiding this comment

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

👍 modular the minor comment @ceedubs made

@wedens
Copy link
Contributor Author

wedens commented May 18, 2017

fixed

@wedens
Copy link
Contributor Author

wedens commented May 18, 2017

I'm not sure how to fix the build. Fails only on non-js 2.12.2

[info] - MonadTrans[ReaderWriterStateT[?[_], String, Int, String, ?]].serializable.can serialize and deserialize *** FAILED *** (45 milliseconds)
[info]   NotSerializableException was thrown during property evaluation.
[info]     Message: cats.data.RWSTInstances$$anon$12
[info]     Occurred when passed generated values (
[info]   
[info]     )

@ceedubs
Copy link
Contributor

ceedubs commented May 18, 2017

Oh @wedens I think that we probably want the MonadTrans trait to extend Any with Serializable. I think that this is being done automatically for our type classes that use simulacrum. See Semigroup for an example of a type class that isn't using simulacrum.

@wedens wedens changed the title MonadTrans instance for RWST MonadTrans instance for RWST and make MonadTrans serializable May 18, 2017
Copy link
Collaborator

@peterneyens peterneyens left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix, @wedens

@peterneyens peterneyens merged commit 6ad7d8f into typelevel:master May 18, 2017
@codecov-io
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@b4995b2). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1680   +/-   ##
=========================================
  Coverage          ?   93.42%           
=========================================
  Files             ?      242           
  Lines             ?     4075           
  Branches          ?      140           
=========================================
  Hits              ?     3807           
  Misses            ?      268           
  Partials          ?        0
Impacted Files Coverage Δ
.../src/main/scala/cats/data/ReaderWriterStateT.scala 96% <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 b4995b2...138d54b. Read the comment docs.

@wedens wedens deleted the rwst_monad_trans branch May 18, 2017 16:54
@kailuowang kailuowang modified the milestone: 1.0.0-MF May 18, 2017
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