Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kentfrazier
Copy link
Contributor

First off, this is my first PR to zio, so please let me know if I am not following proper procedures or if there is anything else I should have done to be a better contributor. I am also only a week or so into using zio, so feedback about better ways to accomplish my goals is also very welcome.

When a module has a member with a return type of ZManaged[R, E, A], I think the expected accessor generated by @accessible would be ZManaged[R with Has[Service], E, A], but the current implementation seems to fall back to treating it as a method and generates an accessor with return type ZIO[Has[Service], Throwable, ZManaged[R, E, A]] which is more difficult to work with and doesn't match the API provided by the other ZIO classes.

This PR addresses the issue by adding in specific handling for ZManaged in AccessibleMacro, in a way that mostly mirrors the way ZIO itself is handled (though ZManaged.accessM doesn't compose the same way, so I had to use a slightly different approach there.) I was mostly just following the example of the surrounding code, which was fairly easy to follow, especially for macro code. I added tests to verify the new behavior and make sure that it had coverage similar to the level of the effect types.

Let me know if anything looks improper and I am happy to fix it. Thanks!

@CLAassistant
Copy link

CLAassistant commented Jun 13, 2020

CLA assistant check
All committers have signed the CLA.

@adamgfraser
Copy link
Contributor

@kentfrazier Thanks for contributing! Sounds right to me. @ioleo Can you take a look?

Copy link
Member

@ioleo ioleo left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍
@kentfrazier Thank you for contributing!

@kentfrazier
Copy link
Contributor Author

@adamgfraser any progress on this? It looks like it got approved, but hoping these changes will make it into the next release. Thanks!

@adamgfraser adamgfraser merged commit ab292c7 into zio:master Jul 10, 2020
@adamgfraser
Copy link
Contributor

@kentfrazier Thanks for the reminder! Merged now.

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.

4 participants