lloydmeta / frunk

Funktional generic type-level programming in Rust: HList, Coproduct, Generic, LabelledGeneric, Validated, Monoid and friends.
https://beachape.com/frunk/
MIT License
1.29k stars 58 forks source link

Make `foldl` and `foldr` take exactly same arguments #178

Closed ImmemorConsultrixContrarie closed 3 years ago

ImmemorConsultrixContrarie commented 3 years ago

Closes #171.

Unresolved question: do we want dirty hacks to completely unify foldl and foldr arguments?

ExpHP commented 3 years ago

Regarding the "dirty hacks," yes, I think achieving parity between the two would be nice.

That said, I think I would prefer not seeing #[doc(hidden)] used to hide traits. Frunk has always been pretty open with its traits, even when they are things we might prefer to be implementation details. Seeing a trait bound in the docs that you can't click on can be kind of frustrating when there's no clue what it is for. So I would suggest adding a note to it explaining precisely why it needs to exist (IIUC, Foldr with a single unborrowed Fns) and discouraging users from using it directly.

(there is the downside of them appearing in search results. If only there were a #[doc(no_search)]!)

ImmemorConsultrixContrarie commented 3 years ago

By the way, since this PR is highly likely to get merged and is a breaking change, you may want to add a bunch of other breaking changes to the patch until you push the new version, @lloydmeta.

lloydmeta commented 3 years ago

There was a check failing due to a new clippy recommendation, which I fixed on master, merging into this branch to see if it passes..

@ImmemorConsultrixContrarie do you want to add a short for the change in this PR in https://github.com/lloydmeta/frunk/blob/master/CHANGELOG.md ? If not, I can do it later.