In the cats docs they show an example for Semigroup[Int]:
val list = List(1, 2, 3, 4, 5) val rightwards = List(1, 2, 3).foldRight(0)(_ |+| _) So the |+| operator is a semigroup combine. What's the point of this extra machinery if good 'ol "+" works just fine here? What does the Semigroup buy you for Int, or likely for any simple type for that matter?
Semigroupis an abstraction,Int+is an implementation. Abstractions (FP type classes or OOP interfaces/traits) are good for decoupling.Animalif I all I want is aDog- BTW, in this case you can actually see advantages without needing to go abstract, just usecombineAllrather thanfoldRightor use|+|with two maps whose values areInts