Skip to content

Commit

Permalink
remove optimization of commutative semigroup intercalate combineN whi…
Browse files Browse the repository at this point in the history
…ch fails for almost commutative BigDecimal
  • Loading branch information
johnynek committed Feb 1, 2020
1 parent c4e8104 commit 86a5088
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions kernel/src/main/scala/cats/kernel/CommutativeSemigroup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ trait CommutativeSemigroup[@sp(Int, Long, Float, Double) A] extends Any with Sem
new CommutativeSemigroup[A] {
def combine(a: A, b: A): A =
self.combine(a, self.combine(middle, b))

override def combineN(a: A, n: Int): A =
if (n <= 1) self.combineN(a, n)
else {
// a + m + a ... = combineN(a, n) + combineN(m, n - 1)
self.combine(self.combineN(a, n), self.combineN(middle, n - 1))
}
}
}

Expand Down

0 comments on commit 86a5088

Please sign in to comment.