Sometimes the Scala parser/compiler is not happy about Monoid 'addition' and things like
a + b where a and b are monoids of type A won't work because it thinks the + is for a String addition.
found : C
required: String
(from what I can gather it doesn't work when there is a type parameter C >: B : Monoid and then we want to do
'addition' on two monoids of type C)
Even if one defines another operator, say |+|, it stills fails with an error of that kind:
Error:(81, 45) value |+| is not a member of type parameter C
Fun fact: intelliji actually parses things correctly!
So this is why the weird object M exists, to 'lift' a Monoid.
Sometimes the Scala parser/compiler is not happy about Monoid 'addition' and things like a + b where a and b are monoids of type A won't work because it thinks the + is for a String addition.
found : C required: String
(from what I can gather it doesn't work when there is a type parameter C >: B : Monoid and then we want to do 'addition' on two monoids of type C) Even if one defines another operator, say |+|, it stills fails with an error of that kind: Error:(81, 45) value |+| is not a member of type parameter C
Fun fact: intelliji actually parses things correctly!
So this is why the weird object M exists, to 'lift' a Monoid.