object Foldable
- Companion
- class
Type members
Classlikes
Template trait to define Foldable
in terms of foldMap
.
Template trait to define Foldable
in terms of foldMap
.
Example:
new Foldable[Option] with Foldable.FromFoldMap[Option] {
def foldMap[A, B](fa: Option[A])(f: A => B)(implicit F: Monoid[B]) = fa match {
case Some(a) => f(a)
case None => F.zero
}
}