ExponentialIsCommutativeMonoid
Provides an implicit implementation of a commutative group for the Exponential type, supporting group operations such as identity, combination, and inversion.
This allows Exponential objects to adhere to the algebraic structure of a commutative group, where the combine operation is associative and commutative, an identity element exists, and each element has an additive inverse.
Attributes
- Graph
-
- Supertypes
-
trait CommutativeMonoid[Exponential]trait CommutativeSemigroup[Exponential]trait Monoid[Exponential]trait Semigroup[Exponential]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
Members list
Value members
Concrete methods
Combines two Exponential instances by adding their respective value. NOTE that this is the equivalent of multiplying the corresponding (exponential) values. This method is associative and commutative, meaning that the order of the arguments does not matter. The identity element is the zero value, which is the neutral element for the addition operation.
Combines two Exponential instances by adding their respective value. NOTE that this is the equivalent of multiplying the corresponding (exponential) values. This method is associative and commutative, meaning that the order of the arguments does not matter. The identity element is the zero value, which is the neutral element for the addition operation.
Value parameters
- x
-
the first
Exponentialto combine - y
-
the second
Exponentialto combine
Attributes
- Returns
-
a new
Exponentialrepresenting the sum of the value of the two providedExponentialinstances - Note
-
Throws an com.phasmidsoftware.number.algebra.util.AlgebraException if the input types are not compatible.
Inherited methods
Given a sequence of as, sum them using the monoid and return the total.
Given a sequence of as, sum them using the monoid and return the total.
Example:
scala> import cats.kernel.instances.string._
scala> Monoid[String].combineAll(List("One ", "Two ", "Three"))
res0: String = One Two Three
scala> Monoid[String].combineAll(List.empty)
res1: String = ""
Attributes
- Inherited from:
- Monoid
Given a sequence of as, combine them and return the total.
Given a sequence of as, combine them and return the total.
If the sequence is empty, returns None. Otherwise, returns Some(total).
Example:
scala> import cats.kernel.instances.string._
scala> Semigroup[String].combineAllOption(List("One ", "Two ", "Three"))
res0: Option[String] = Some(One Two Three)
scala> Semigroup[String].combineAllOption(List.empty)
res1: Option[String] = None
Attributes
- Definition Classes
-
Monoid -> Semigroup
- Inherited from:
- Monoid
Return a appended to itself n times.
Return a appended to itself n times.
Example:
scala> import cats.kernel.instances.string._
scala> Monoid[String].combineN("ha", 3)
res0: String = hahaha
scala> Monoid[String].combineN("ha", 0)
res1: String = ""
Attributes
- Definition Classes
-
Monoid -> Semigroup
- Inherited from:
- Monoid
Between each pair of elements insert middle This name matches the term used in Foldable and Reducible and a similar Haskell function.
Between each pair of elements insert middle This name matches the term used in Foldable and Reducible and a similar Haskell function.
Attributes
- Definition Classes
-
CommutativeSemigroup -> Semigroup
- Inherited from:
- CommutativeSemigroup
Tests if a is the identity.
Tests if a is the identity.
Example:
scala> import cats.kernel.instances.string._
scala> Monoid[String].isEmpty("")
res0: Boolean = true
scala> Monoid[String].isEmpty("something")
res1: Boolean = false
Attributes
- Inherited from:
- Monoid
return a semigroup that reverses the order so combine(a, b) == reverse.combine(b, a)
return a semigroup that reverses the order so combine(a, b) == reverse.combine(b, a)
Attributes
- Definition Classes
-
CommutativeMonoid -> CommutativeSemigroup -> Monoid -> Semigroup
- Inherited from:
- CommutativeMonoid
Concrete fields
Provides the identity element for the Exponential group, representing a Exponential of zero value.
Provides the identity element for the Exponential group, representing a Exponential of zero value.
Attributes
- Returns
-
a
Exponentialinstance with zero value, acting as the identity element in the group structure.