The Commutative type class describes a binary operator for a type A that is both associative and commutative. This means that a1 <> a2 is equal to a2 <> a1 for all values a1 and a2. Examples of commutative operations include addition for integers, but not concatenation for strings.
Commutative operators are useful because combining values with a commutative operation results in the same value regardless of the order in which values are combined, allowing us to combine values in the order that is most efficient and allowing us to return determinate values even when the order of original values is indeterminate.
Attributes
- Companion
- object
- Graph
-
- Supertypes
- Known subtypes
-
trait CommutativeEqual[A]trait CommutativeIdentity[A]
- Self type
-
Commutative[A]
Members list
Value members
Concrete methods
Returns a new Commutative instance that describes the same binary operator but applied in reverse order. Since the operation is commutative this instance is guaranteed to return the same results as the original instance but one order of combination or the other may be more efficient in certain cases.
Returns a new Commutative instance that describes the same binary operator but applied in reverse order. Since the operation is commutative this instance is guaranteed to return the same results as the original instance but one order of combination or the other may be more efficient in certain cases.
Attributes
Returns a new Commutative instance that describes the same binary operator but applied in reverse order. Since the operation is commutative this instance is guaranteed to return the same results as the original instance but one order of combination or the other may be more efficient in certain cases.
Returns a new Commutative instance that describes the same binary operator but applied in reverse order. Since the operation is commutative this instance is guaranteed to return the same results as the original instance but one order of combination or the other may be more efficient in certain cases.
Attributes
Returns a new Commutative instance that describes the same binary operator but applied in reverse order. Since the operation is commutative this instance is guaranteed to return the same results as the original instance but one order of combination or the other may be more efficient in certain cases.
Returns a new Commutative instance that describes the same binary operator but applied in reverse order. Since the operation is commutative this instance is guaranteed to return the same results as the original instance but one order of combination or the other may be more efficient in certain cases.
Attributes
Inherited methods
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative
Attributes
- Inherited from:
- Associative