8000 Compositional Fiber Ref Updates by adamgfraser · Pull Request #6485 · zio/zio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Compositional Fiber Ref Updates #6485

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

Merged
merged 15 commits into from
Mar 30, 2022
Merged

Compositional Fiber Ref Updates #6485

merged 15 commits into from
Mar 30, 2022

Conversation

adamgfraser
Copy link
Contributor

Allows defining a FiberRef based on a patch type that describes updates to the FiberRef as a data structure. This allows composing updates by multiple fibers to more complex values such as the ZEnvironment without "clobbering". The existing FiberRef semantics are implemented as a specialized case where the patch is just a setter function.

@adamgfraser < 10000 /div>
@adamgfraser adamgfraser changed the title Composition Fiber Ref Updates Compositional Fiber Ref Updates Mar 27, 2022
val (missingServices, patch) = sorted.foldLeft[(Map[LightTypeTag, Any], Patch[In, Out])](
oldValue.map -> Patch.Empty().asInstanceOf[Patch[In, Out]]
) { case ((map, patch), (tag, (newService, _))) =>
map.get(tag) match {
Copy link
Member

Choose a reason for hiding this comment

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

If possible, we should have a couple tests to ensure that patching ZEnvironment is well-defined.

@adamgfraser adamgfraser requested a review from jdegoes March 30, 2022 11:54
@jdegoes jdegoes merged commit be10659 into zio:series/2.x Mar 30, 2022
@adamgfraser adamgfraser deleted the patch branch March 30, 2022 18:47
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
0