twitter / algebird

Abstract Algebra for Scala
https://twitter.github.io/algebird
Apache License 2.0
2.29k stars 346 forks source link

Add combinators on Semigroup, Monoid, Aggregator to reverse order. #741

Open johnynek opened 4 years ago

johnynek commented 4 years ago

see comment here:

https://github.com/twitter/algebird/pull/739#discussion_r343814345

reversing the order of semigroup preserves it being a semigroup, as does putting a constant element between every pair. This could be a combinator on semigroup that we could propagate up to other Semigroup related abstractions, e.g. Aggregator, Fold, Scan.

regadas commented 4 years ago

Hi @johnynek just saw your change @ https://github.com/typelevel/cats/pull/3279 ... I think it will be handy for this one.