SignAlgebra

class SignAlgebra extends CommutativeMonoid[Sign] with Signed[Sign]
trait Signed[Sign]
trait Order[Sign]
trait PartialOrder[Sign]
trait Eq[Sign]
trait CommutativeMonoid[Sign]
trait CommutativeSemigroup[Sign]
trait Monoid[Sign]
trait Semigroup[Sign]
trait Serializable
class Object
trait Matchable
class Any

Value members

Concrete methods

def abs(a: Sign): Sign
def combine(a: Sign, b: Sign): Sign
def compare(x: Sign, y: Sign): Int
def empty: Sign
override
def sign(a: Sign): Sign
Definition Classes
def signum(a: Sign): Int

Inherited methods

def combineAll(as: IterableOnce[Sign]): Sign

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 = ""
Inherited from
Monoid
override
def combineAllOption(as: IterableOnce[Sign]): Option[Sign]
Definition Classes
Monoid -> Semigroup
Inherited from
Monoid
override
def combineN(a: Sign, n: Int): Sign

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 = ""
Definition Classes
Monoid -> Semigroup
Inherited from
Monoid
def comparison(x: Sign, y: Sign): Comparison

Like compare, but returns a cats.kernel.Comparison instead of an Int. Has the benefit of being able to pattern match on, but not as performant.

Like compare, but returns a cats.kernel.Comparison instead of an Int. Has the benefit of being able to pattern match on, but not as performant.

Inherited from
Order
override
def eqv(x: Sign, y: Sign): Boolean

Returns true if x = y, false otherwise.

Returns true if x = y, false otherwise.

Definition Classes
Order -> PartialOrder -> Eq
Inherited from
Order
override
def gt(x: Sign, y: Sign): Boolean

Returns true if x > y, false otherwise.

Returns true if x > y, false otherwise.

Definition Classes
Order -> PartialOrder
Inherited from
Order
override
def gteqv(x: Sign, y: Sign): Boolean

Returns true if x >= y, false otherwise.

Returns true if x >= y, false otherwise.

Definition Classes
Order -> PartialOrder
Inherited from
Order
override
def intercalate(middle: Sign): CommutativeSemigroup[Sign]
Definition Classes
CommutativeSemigroup -> Semigroup
Inherited from
CommutativeSemigroup
def isEmpty(a: Sign)(implicit ev: Eq[Sign]): Boolean

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
Inherited from
Monoid
def isSignNegative(a: Sign): Boolean
Inherited from
Signed
def isSignNonNegative(a: Sign): Boolean
Inherited from
Signed
def isSignNonPositive(a: Sign): Boolean
Inherited from
Signed
def isSignNonZero(a: Sign): Boolean
Inherited from
Signed
def isSignPositive(a: Sign): Boolean
Inherited from
Signed
def isSignZero(a: Sign): Boolean
Inherited from
Signed
override
def lt(x: Sign, y: Sign): Boolean

Returns true if x < y, false otherwise.

Returns true if x < y, false otherwise.

Definition Classes
Order -> PartialOrder
Inherited from
Order
override
def lteqv(x: Sign, y: Sign): Boolean

Returns true if x <= y, false otherwise.

Returns true if x <= y, false otherwise.

Definition Classes
Order -> PartialOrder
Inherited from
Order
def max(x: Sign, y: Sign): Sign

If x > y, return x, else return y.

If x > y, return x, else return y.

Inherited from
Order
def min(x: Sign, y: Sign): Sign

If x < y, return x, else return y.

If x < y, return x, else return y.

Inherited from
Order
override
def neqv(x: Sign, y: Sign): Boolean

Returns true if x != y, false otherwise.

Returns true if x != y, false otherwise.

Note: this default implementation provided by Order is the same as the one defined in Eq, but for purposes of binary compatibility, the override in Order has not yet been removed. See this discussion.

Definition Classes
Order -> Eq
Inherited from
Order
def partialCompare(x: Sign, y: Sign): Double
Inherited from
Order
def partialComparison(x: Sign, y: Sign): Option[Comparison]

Like partialCompare, but returns a cats.kernel.Comparison instead of an Double. Has the benefit of being able to pattern match on, but not as performant.

Like partialCompare, but returns a cats.kernel.Comparison instead of an Double. Has the benefit of being able to pattern match on, but not as performant.

Inherited from
PartialOrder
def pmax(x: Sign, y: Sign): Option[Sign]

Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.

Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.

Inherited from
PartialOrder
def pmin(x: Sign, y: Sign): Option[Sign]

Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.

Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.

Inherited from
PartialOrder
override
def reverse: CommutativeMonoid[Sign]
Definition Classes
CommutativeMonoid -> CommutativeSemigroup -> Monoid -> Semigroup
Inherited from
CommutativeMonoid
def toOrdering: Ordering[Sign]

Convert a Order[A] to a scala.math.Ordering[A] instance.

Convert a Order[A] to a scala.math.Ordering[A] instance.

Inherited from
Order
def tryCompare(x: Sign, y: Sign): Option[Int]

Result of comparing x with y. Returns None if operands are not comparable. If operands are comparable, returns Some[Int] where the Int sign is:

Result of comparing x with y. Returns None if operands are not comparable. If operands are comparable, returns Some[Int] where the Int sign is:

  • negative iff x < y
  • zero iff x = y
  • positive iff x > y
Inherited from
PartialOrder