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

RFC: Nomenclature for fold functions #39

Closed
harendra-kumar opened this issue Mar 24, 2018 · 3 comments · Fixed by #58
Closed

RFC: Nomenclature for fold functions #39

harendra-kumar opened this issue Mar 24, 2018 · 3 comments · Fixed by #58
Labels
api:deprecating Deprecates an API
Milestone

Comments

@harendra-kumar
Copy link
Member

Currently we have foldl and foldlM functions whose signatures are more general than the standard ones and inline with the foldl library. It means that they are slightly different from the standard fold functions. To keep full compatibility with the nomenclature of standard lists and Foldable we should perhaps use different names for the functions created for the purposes of foldl.

The names foldl, foldl', foldl1 are all taken. The name fold is used by Foldable typeclass. If we are not going to have a Foldable instance we can use fold, foldM for these general functions. Note that we also have scan that is a general version of scanl.

@harendra-kumar harendra-kumar added the api:breaking Incompatible with existing releases label Mar 24, 2018
@harendra-kumar harendra-kumar added this to the 0.2.0 milestone Mar 24, 2018
@harendra-kumar
Copy link
Member Author

harendra-kumar commented Mar 24, 2018

Instead of making it a breaking change we can also deprecate the old function names.

@harendra-kumar
Copy link
Member Author

We should perhaps use foldl' for strict left fold to be inline with Foldable. Do we need a lazy left fold?

@harendra-kumar
Copy link
Member Author

It might make sense to provide a fold and a foldMap function in line with the Foldable typeclass. So those names should probably not be reused.

How about foldx and foldxM where the x can be thought of as a mnemonic for extraction function required in the foldl library compatible fold functions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:deprecating Deprecates an API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant