What will be the result of combining Strings for a Monoid?
import cats.implicits._
import cats.kernel.Monoid

Monoid[String].combineAll(List("a", "b", "c"))
Explanation
Monoid.combineAll performs operation combine for all elements with zero element. In the current example, zero element for Strings is empty String "", which being concatenated with other elements of the lists results in "abc".

Source: Scala Exercises: cats monoid

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Scala quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes