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

Map Exception and inner value #79

Open
Clindbergh opened this issue Nov 29, 2021 · 2 comments
Open

Map Exception and inner value #79

Clindbergh opened this issue Nov 29, 2021 · 2 comments

Comments

@Clindbergh
Copy link

In the following code

IEnumerable<(A, Option<B, Exception>)> result = aValues
                .Select(a => (a, a.ComputeB())

I wish to transform the value (A, Option<B, Exception>) to Option<(A, B), (A, Exception)>.

For this operation a Map operation that transforms both, the inner value or the exception value is missing. It is only possible to specify one mapper instead of a mapper for both cases.

@nlkl
Copy link
Owner

nlkl commented Nov 29, 2021

Any reason a chained .Map(...).MapException(...) wouldn't do? My initial thought is that it seems a bit too much of an edge case to have a dedicated method for the purpose.

@Clindbergh
Copy link
Author

Clindbergh commented Nov 29, 2021

Actually, that would work. I wonder if it is really such an edge case.

As I didn't recognize that solution immediately, I have already created an extended Map function. Feel free to merge or reject it.

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