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

Implemented following two array helper functions with corresponding unit tests #133

Closed
wants to merge 1 commit into from

Conversation

chainone
Copy link

MapFilter: Return a array of V by applying transform to all elements
of array 'U' and filtering out failure ones

MapM: Return a Result with an array of Vs if all Results of applying
transform are Successes or return the error of the first Failure

tests:
MapFilter: Return a array of `V` by applying transform to all elements
of array 'U' and filtering out failure ones

MapM: Return a Result with an array of `V`s if all Results of applying
`transform` are `Success`es or return the error of the first `Failure`
}
}
return Result(vs)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think both of these would be more idiomatic if expressed as extension methods on CollectionType. Not only more idiomatic, but they’d also be available on collections other than Array.

@robrix
Copy link
Contributor

robrix commented Dec 28, 2015

Thanks for the pull request! 🙇

This functionality is quite useful. I’ve left a few notes above, but you might not want to address any/all of them straight away since there’s some question about where this should end up living.

We’ve typically shied away from including extensions on other types in Result, but we’ve been discussing providing a home for them, possibly in a separate framework.

@antitypical/result, what do you think? Is this a good motivator for a contrib framework or similar, or does this belong in Result proper?

@NachoSoto
Copy link
Contributor

I agree, this is useful but it seems out of the scope of Result itself.

@chainone chainone closed this by deleting the head repository Nov 20, 2023
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.

3 participants