-
-
Notifications
You must be signed in to change notification settings - Fork 64
Create effect module w/ instances for IO #342
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
Conversation
54c481b to
e75428f
Compare
| IOLocal(0) | ||
| .flatMap { implicit local => | ||
| IO.delay(checkAll("Stateful[IO]", StatefulTests[IO, Int].stateful)) | ||
| } | ||
| .unsafeRunAndForget() |
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.
This test doesn't work right now, and IDK how to make it work. The tricky part is to create an instance of Stateful[IO, Int] we need an IOLocal[Int] first which only comes in an IO.
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.
https://github.com/typelevel/munit-cats-effect
Have a look at the Resource support! :-)
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!! Looking
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.
This is now hacked/fixed 🙃
|
So I think this is a great idea, but for development this does build a cycle cats-effect depends on cats-mtl for Test scope. So whenever a new binary incompatible scala version drops this will need to not be released. Then cats-effect released, and then this module released. I still think this is probably the right place. But its probably worth noting. |
Oops. Wouldn't this be much easier as a CE module then? |
|
Via Discord: @djspiewak suggests adding this module would be "dodgy". Alternatives are that this goes in Cats Effect or I spin up a microlib. Also pinging @oleg-py for his thoughts. Also want to reference #120 which (possibly in some variation) could also find a happy home with effect-related stuff. Edit: Also #86's StateIO can join too? Finally, can someone help me figure out the build failure? I don't understand what it's referencing. Thanks! |
| import cats.mtl.laws.discipline.{HandleTests, StatefulTests} | ||
|
|
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 don't understand why the imports need to be here, but the other tests do it too.
|
I ended up putting these odds and ends together in a microlib: https://github.com/armanbilge/oxidized |
So far I've added instances for
StatefulandHandleforIO. Any others I can provide? Or for other datatypes in CE3?