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

Add ZIO#provideM #1522

Merged
merged 4 commits into from Aug 30, 2019
Merged

Add ZIO#provideM #1522

merged 4 commits into from Aug 30, 2019

Conversation

adamgfraser
Copy link
Contributor

As discussed on Gitter, this PR adds a provideM method on ZIO and ZStream that provides all of the required environment to an effect where the act of creating the environment itself requires an effect. This can already be accomplished using flatMap and then provide or provideSomeM but I think this is a nice convenience method. Using flatMap and then provide can sometimes generate spurious warnings about types being inferred as Any. And while provideSomeM works, the name doesn't make clear that you can or are providing the whole environment and the compiler won't enforce that the whole environment has been provided.

Overall I think understanding how to work with the environment parameter is one of the harder things for newcomers so we should make it as easy as possible.

Copy link
Member

@jdegoes jdegoes left a comment

Choose a reason for hiding this comment

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

Sweet!

@jdegoes jdegoes merged commit 18d34ba into zio:master Aug 30, 2019
@adamgfraser adamgfraser deleted the provideM branch August 30, 2019 20:48
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.

None yet

2 participants