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.
Maybe there could be added a derive macro for
Semigroup
trait which would docombine
per field like is done with tuples. (Also why not add it also for same-sized arrays?)I noticed that
Min
andMax
implementSemigroup
for any type that hasOrd
but on the other hand all others likeAll
,Any
andProduct
are implemented only for numeric types. Why not implementSemigroup
forProduct
for any type which can beMul
tiplied with itself (and similarly forAll
andAny
)? And maybeSemigroup
could be implemented as an addition for any type which hasAdd
or maybe better add someSum
wrapper type which would do that.