1 trait Foldable[F[_]] { self =>
2 ////
3 import collection.generic.CanBuildFrom 4 import collection.immutable.IndexedSeq 5
6 /** Map each element of the structure to a [[scalaz.Monoid]], and combine the results. */
7 def foldMap[A,B](fa: F[A])(f: A => B)(implicit F: Monoid[B]): B
1 trait ListInstances extends ListInstances0 { 2 implicit val listInstance = new Traverse[List] with MonadPlus[List] with Zip[List] with Unzip[List] with Align[List] with IsEmpty[List] with Cobind[List] { 3 ...
1 def foldLShape[A,B](fa: F[A], z: B)(f: (B,A) => B): (B, F[Unit]) =
2 runTraverseS(fa, z)(a => State.modify(f(_, a))) 3
4 override def foldLeft[A,B](fa: F[A], z: B)(f: (B,A) => B): B = foldLShape(fa, z)(f)._1 5
6 def foldMap[A,B](fa: F[A])(f: A