Is there an existing Monoid
instance for scala.collection.parallel.ParMap
in Cats? I don't think so, but I am not certain.
If not, then how would I go about creating such an instance? Here is what I have so far...
import cats._
import implicits._
def parMapMonoid[K, V]: Monoid[ParMap[K, V]] = {
new Monoid[ParMap[K, V]] {
def combine(v1: ParMap[K, V], v2: ParMap[K, V]): ParMap[K, V] = {
???
}
def empty: ParMap[K, V] = {
ParMap.empty[K, V]
}
}
}
...you can assume that there is an appropriate Monoid
instance defined for the type V
. For the specific use case I have in mine type V=Int
.