cats.evidence

Type members

Classlikes

sealed abstract class As[-A, +B] extends Serializable

As substitutability: A better <:<

As substitutability: A better <:<

This class exists to aid in the capture proof of subtyping relationships, which can be applied in other context to widen other type

A As B holds whenever A could be used in any negative context that expects a B. (e.g. if you could pass an A into any function that expects a B as input.)

This code was ported directly from scalaz to cats using this version from scalaz: https://github.com/scalaz/scalaz/blob/a89b6d63/core/src/main/scala/scalaz/Liskov.scala

The original contribution to scalaz came from Jason Zaugg

Companion
object
object As extends AsInstances with AsSupport
Companion
class
sealed abstract class AsInstances
abstract class Is[A, B] extends Serializable

A value of A Is B is proof that the types A and B are the same. More powerfully, it asserts that they have the same meaning in all type contexts. This can be a more powerful assertion than A =:= B and is more easily used in manipulation of types while avoiding (potentially erroneous) coercions.

A value of A Is B is proof that the types A and B are the same. More powerfully, it asserts that they have the same meaning in all type contexts. This can be a more powerful assertion than A =:= B and is more easily used in manipulation of types while avoiding (potentially erroneous) coercions.

A Is B is also known as Leibniz equality.

Companion
object
object Is extends IsInstances with IsSupport
Companion
class
sealed abstract class IsInstances

Types

type <~<[-A, +B] = As[A, B]

A convenient type alias for As, this declares that A is a subtype of B, and should be able to be a B is expected.

A convenient type alias for As, this declares that A is a subtype of B, and should be able to be a B is expected.

type ===[A, B] = Is[A, B]

A convenient type alias for Is, which declares that A is the same type as B.

A convenient type alias for Is, which declares that A is the same type as B.

type >~>[+B, -A] = As[A, B]

A flipped alias, for those used to their arrows running left to right

A flipped alias, for those used to their arrows running left to right

type Leibniz[A, B] = Is[A, B]

This type level equality represented by Is is referred to as "Leibniz equality", and it had the name "Leibniz" in the scalaz https://en.wikipedia.org/wiki/Gottfried_Wilhelm_Leibniz

This type level equality represented by Is is referred to as "Leibniz equality", and it had the name "Leibniz" in the scalaz https://en.wikipedia.org/wiki/Gottfried_Wilhelm_Leibniz

type Liskov[-A, +B] = As[A, B]

The property that a value of type A can be used in a context expecting a B if A <~< B is referred to as the "Liskov Substitution Principle", which is named for Barbara Liskov: https://en.wikipedia.org/wiki/Barbara_Liskov

The property that a value of type A can be used in a context expecting a B if A <~< B is referred to as the "Liskov Substitution Principle", which is named for Barbara Liskov: https://en.wikipedia.org/wiki/Barbara_Liskov