-
Notifications
You must be signed in to change notification settings - Fork 274
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
Missing combinators for creating and consuming Fold1, and IndexedFold1 's #1015
Comments
Would you @ekmett accept a PR for this? |
Given we export Fold1, I think it'd be reasonable to supply basic combinators for working with them like this. So yes, I would accept a PR. |
I've made a PR that implements the above functions. In a similar vain as this issue, I'm missing maximum1ByOf, minimum1ByOf analogues of maximumByOf and minimumByOf. If you are open to adding combinators like that as well, I can open another PR. |
With those additions, I'm wondering if we shouldn't exile these (along with the combinators in the PR above) to a |
When working with Fold1 and/or IndexedFold1's it would be nice to have functions such as 'folding1' and 'ifolding1' to build the appropriate non-empty folds, and an indexed version of 'toNonEmptyOf' to consume them. In particular, I would suggest the following implementations:
The implementations of folding1 and ifolding1 are almost identical to folding and ifolding (but with a different typeclass constraint). The implementation of iToNonEmptyOf was adapted from toNonEmptyOf
The text was updated successfully, but these errors were encountered: