cats.kernel

package cats.kernel

Type members

Classlikes

Bands are semigroups whose operation (i.e. combine) is also idempotent.

Bands are semigroups whose operation (i.e. combine) is also idempotent.

Companion:
object
object Band extends SemigroupFunctions[Band]
Companion:
class
Companion:
class

An commutative group (also known as an abelian group) is a group whose combine operation is commutative.

An commutative group (also known as an abelian group) is a group whose combine operation is commutative.

Companion:
object

CommutativeMonoid represents a commutative monoid.

CommutativeMonoid represents a commutative monoid.

A monoid is commutative if for all x and y, x |+| y === y |+| x.

Companion:
object

CommutativeSemigroup represents a commutative semigroup.

CommutativeSemigroup represents a commutative semigroup.

A semigroup is commutative if for all x and y, x |+| y === y |+| x.

Companion:
object
sealed abstract class Comparison(val toInt: Int, val toDouble: Double) extends Product with Serializable

ADT encoding the possible results of a comparison

ADT encoding the possible results of a comparison

Companion:
object
object Comparison
Companion:
class
trait Eq[@specialized A] extends Serializable

A type class used to determine equality between 2 instances of the same type. Any 2 instances x and y are equal if eqv(x, y) is true. Moreover, eqv should form an equivalence relation.

A type class used to determine equality between 2 instances of the same type. Any 2 instances x and y are equal if eqv(x, y) is true. Moreover, eqv should form an equivalence relation.

Companion:
object
abstract class EqFunctions[E <: (Eq)]
trait Group[@specialized(Int, Long, Float, Double) A] extends Monoid[A]

A group is a monoid where each element has an inverse.

A group is a monoid where each element has an inverse.

Companion:
object
object Group extends GroupFunctions[Group]
Companion:
class
abstract class GroupFunctions[G <: (Group)] extends MonoidFunctions[G]
trait Hash[@specialized A] extends Eq[A] with Serializable

A type class used to represent a hashing scheme for objects of a given type. For any two instances x and y that are considered equivalent under the equivalence relation defined by this object, hash(x) should equal hash(y).

A type class used to represent a hashing scheme for objects of a given type. For any two instances x and y that are considered equivalent under the equivalence relation defined by this object, hash(x) should equal hash(y).

Companion:
object
object Hash extends HashFunctions[Hash]
Companion:
class
abstract class HashFunctions[H <: (Hash)] extends EqFunctions[H]

A type class used to name the lower limit of a type.

A type class used to name the lower limit of a type.

Companion:
object

A monoid is a semigroup with an identity. A monoid is a specialization of a semigroup, so its operation must be associative. Additionally, combine(x, empty) == combine(empty, x) == x. For example, if we have Monoid[String], with combine as string concatenation, then empty = "".

A monoid is a semigroup with an identity. A monoid is a specialization of a semigroup, so its operation must be associative. Additionally, combine(x, empty) == combine(empty, x) == x. For example, if we have Monoid[String], with combine as string concatenation, then empty = "".

Companion:
object
object Monoid extends MonoidFunctions[Monoid]
Companion:
class
trait Next[@specialized A] extends PartialNext[A]

A typeclass with an operation which returns a member which is always greater than the one supplied.

A typeclass with an operation which returns a member which is always greater than the one supplied.

trait Order[@specialized A] extends PartialOrder[A]

The Order type class is used to define a total ordering on some type A. An order is defined by a relation <=, which obeys the following laws:

The Order type class is used to define a total ordering on some type A. An order is defined by a relation <=, which obeys the following laws:

  • either x <= y or y <= x (totality)
  • if x <= y and y <= x, then x == y (antisymmetry)
  • if x <= y and y <= z, then x <= z (transitivity)

The truth table for compare is defined as follows:

x <= y x >= y Int true true = 0 (corresponds to x == y) true false < 0 (corresponds to x < y) false true > 0 (corresponds to x > y)

By the totality law, x <= y and y <= x cannot be both false.

Companion:
object
abstract class OrderFunctions[O <: (Order)] extends PartialOrderFunctions[O]

A typeclass with an operation which returns a member which is greater or None than the one supplied.

A typeclass with an operation which returns a member which is greater or None than the one supplied.

trait PartialOrder[@specialized A] extends Eq[A]

The PartialOrder type class is used to define a partial ordering on some type A.

The PartialOrder type class is used to define a partial ordering on some type A.

A partial order is defined by a relation <=, which obeys the following laws:

  • x <= x (reflexivity)
  • if x <= y and y <= x, then x = y (anti-symmetry)
  • if x <= y and y <= z, then x <= z (transitivity)

To compute both <= and >= at the same time, we use a Double number to encode the result of the comparisons x <= y and x >= y. The truth table is defined as follows:

x <= yx >= yresultnote
truetrue0.0(corresponds to x = y)
falsefalseNaN(x and y cannot be compared)
truefalse-1.0(corresponds to x < y)
falsetrue1.0(corresponds to x > y)
Companion:
object
abstract class PartialOrderFunctions[P <: (PartialOrder)] extends EqFunctions[P]

A typeclass with an operation which returns a member which is smaller or None than the one supplied.

A typeclass with an operation which returns a member which is smaller or None than the one supplied.

A typeclass with an operation which returns a member which is always smaller than the one supplied.

A typeclass with an operation which returns a member which is always smaller than the one supplied.

A semigroup is any set A with an associative operation (combine).

A semigroup is any set A with an associative operation (combine).

Companion:
object
Companion:
class
abstract class SemigroupFunctions[S <: (Semigroup)]

Semilattices are commutative semigroups whose operation (i.e. combine) is also idempotent.

Semilattices are commutative semigroups whose operation (i.e. combine) is also idempotent.

Companion:
object
abstract class SemilatticeFunctions[S <: (Semilattice)] extends SemigroupFunctions[S]
trait UnboundedEnumerable[@specialized A] extends Next[A] with Previous[A]

A typeclass which has both previous and next operations such that next . previous == identity.

A typeclass which has both previous and next operations such that next . previous == identity.

A type class used to name the upper limit of a type.

A type class used to name the upper limit of a type.

Companion:
object