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

Skip to content

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.

2 participants