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

[Proposal] BindZip to store both income and outcome of Bind #535

Open
hankovich opened this issue Mar 28, 2024 · 2 comments
Open

[Proposal] BindZip to store both income and outcome of Bind #535

hankovich opened this issue Mar 28, 2024 · 2 comments

Comments

@hankovich
Copy link
Collaborator

I have a lot of code like

GetEntity(entityId)
    .Bind(entity => GetNestedEntity(entity.NestedEntityId).Map(nestedEntities => (entity, nestedEntities));

Result<Entity> GetEntity(EntityId id) => throw null!;

Result<NestedEntity> GetNestedEntity(NestedEntityId id) => throw null!;

i.e. in further processing I need both income and outcome of Bind. I suggest to add a new method BindZip

GetEntity(entityId)
    .BindZip(entity => GetNestedEntities(entityId)); // returns Result<(Entity First, NestedEntity Second)>
@hankovich
Copy link
Collaborator Author

It's not only me who needs such overload: #534

@vkhorikov
Copy link
Owner

Sorry for the late reply.
Sure, let's add this.

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

No branches or pull requests

2 participants