Provides Monoid instances for standard types and utility methods for working with monoids.
Attributes
Members list
Type members
Classlikes
An implicit object representing a monoid instance for the Double type. This instance provides the monoid operation (addition) and identity element (zero) for Double.
An implicit object representing a monoid instance for the Double type. This instance provides the monoid operation (addition) and identity element (zero) for Double.
Attributes
- Supertypes
-
trait Monoid[Double]trait DoubleZerotrait Zero[Double]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
MonoidDouble.type
Provides an implicit instance of Monoid for the String type, with behavior defined as string concatenation and an empty string as the identity element.
Provides an implicit instance of Monoid for the String type, with behavior defined as string concatenation and an empty string as the identity element.
This implementation extends Zero.StringZero, inheriting the zero value for String.
Attributes
- Supertypes
-
trait Monoid[String]trait StringZerotrait Zero[String]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
MonoidString.type
Value members
Concrete methods
Folds a sequence of elements of type X into a single value using the provided Monoid instance. The folding operation starts with the zero value of the Monoid and combines all elements of the sequence using the combine method of the Monoid.
Folds a sequence of elements of type X into a single value using the provided Monoid instance. The folding operation starts with the zero value of the Monoid and combines all elements of the sequence using the combine method of the Monoid.
Value parameters
- xs
-
the sequence of elements to fold
Attributes
- Returns
-
the result of folding the sequence using the
Monoid
Implicits
Implicits
Returns a Monoid instance for a tuple (A, B) where both A and B have Monoid instances. The combine method for this tuple Monoid combines the elements of each tuple using the combine method of their respective Monoid instances. The zero value represents a tuple where each element is the zero value of the corresponding Monoid.
Returns a Monoid instance for a tuple (A, B) where both A and B have Monoid instances. The combine method for this tuple Monoid combines the elements of each tuple using the combine method of their respective Monoid instances. The zero value represents a tuple where each element is the zero value of the corresponding Monoid.
Type parameters
- A
-
the type of the first element in the tuple, which has a
Monoidinstance - B
-
the type of the second element in the tuple, which has a
Monoidinstance
Attributes
- Returns
-
a
Monoidinstance for the tuple(A, B)