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

Possible Semigroup improvements #235

Open
misos1 opened this issue Jun 4, 2024 · 0 comments
Open

Possible Semigroup improvements #235

misos1 opened this issue Jun 4, 2024 · 0 comments

Comments

@misos1
Copy link

misos1 commented Jun 4, 2024

Maybe there could be added a derive macro for Semigroup trait which would do combine per field like is done with tuples. (Also why not add it also for same-sized arrays?)

I noticed that Min and Max implement Semigroup for any type that has Ord but on the other hand all others like All, Any and Product are implemented only for numeric types. Why not implement Semigroup for Product for any type which can be Multiplied with itself (and similarly for All and Any)? And maybe Semigroup could be implemented as an addition for any type which has Add or maybe better add some Sum wrapper type which would do that.

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

1 participant