What will be the result of combineAll for the following Monoid?
import cats.implicits._
import cats.kernel.Monoid

Monoid[String].combineAll(List())
Explanation
Function combineAll can take List as a parameter. In current example, it is an empty list. Since Monoid is of type String, the combine is done for empty list of Strings that returns a zero value, which is an empty String.

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