trait
Inverse[A] extends Identity[A]
Abstract Value Members
-
abstract
def
combine(l: ⇒ A, r: ⇒ A): A
-
abstract
def
identity: A
-
abstract
def
inverse(l: ⇒ A, r: ⇒ A): A
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
-
-
def
finalize(): Unit
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
intersperse(middle: A): Associative[A]
-
final
def
isInstanceOf[T0]: Boolean
-
def
multiply(n: Int)(a: A): A
-
def
multiplyOption(n: Int)(a: A): Some[A]
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
repeat(a: A)(n: Int): A
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
The
Inverse
type class describes an associative binary operator for a typeA
that has an identity element and an inverse binary operator. Combining any value with itself with the inverse operator must return the identity element. For example, for integer addition zero is an identty element and subtraction is an inverse operation, because subtracting any value from itself always returns zero.Because
Inverse
defines a binary rather than a unary operator it can be used to describe inverse operations for types that do not have inverse values. For example, the natural numbers do not have inverses because the set of natural numbers does not include negative numbers. But we can still define a subtraction operation that is the inverse of addition for the natural numbers, since subtracting a number from itself always returns zero.