A list or array of monoid type A
is a monoid too. Now I would like to combine
arrays of integers using cats
.
scala> 1 |+| 2
res1: Int = 3
scala> Array(1, 2, 3) |+| Array(1, 2, 3)
<console>:21: error: value |+| is not a member of Array[Int]
Array(1, 2, 3) |+| Array(1, 2, 3)
I would like to get Array(2, 4, 6)
as a result of Array(1, 2, 3) |+| Array(1, 2, 3)
instead. How can I do that ?