While I can do
Map("a" -> 1) |+| Map("a" -> 2)
It seems there is no support for
TrieMap("a" -> 1) |+| TrieMap("a" -> 2)
Why ?
While I can do
Map("a" -> 1) |+| Map("a" -> 2)
It seems there is no support for
TrieMap("a" -> 1) |+| TrieMap("a" -> 2)
Why ?
Scalaz
doesn't provide every possible Type+Operation combination that form a Semigroup, but you can easily implement it, for instance with the followingimplicit
:That gives you as expected:
Of course that will work for every value as semigroup that has been defined in
scalaz
.What about Monoid?
If you want an optimised version of the
implicit
that works as a Monoid too:(code shameless adapted from
scalaz/std/Map.scala
)