i try to learn/understand a little bit of scalaz. For that i started with the example:
List(3, 4, 5).asMA.foldMap(x => x)
=> 12 //(3+4+5)
def foldMap[B](f: A => B)(implicit r: Foldable[M], m: Monoid[B])
So somewhere has to be an Foldable[List[_]] and a Monoid[Int] (with append = + and zero = 0). But i wasn't able to find these two implicits. Is there an easy way to find them?
Then the next example was:
List(3, 4, 5).asMA.foldMap(multiplication)
=> 60 //(3*4*5)
Here i get even more confused. I assumed that multiplication has to be replace the Monoid[Int] with one with append = *, zero = 1. But then f: A=>B is missing. And if i follow multiplication i don't find anything connected to a Monoid or function etc.
sealed trait IntMultiplication extends NewType[Int]
trait NewType[X] {
val value: X
override def toString = value.toString
}