package evidence
- Alphabetic
- By Inheritance
- evidence
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
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.
-
type
===[A, B] = Is[A, 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
-
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 wheneverA
could be used in any negative context that expects aB
. (e.g. if you could pass anA
into any function that expects aB
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/As.scala
The original contribution to scalaz came from Jason Zaugg
- sealed abstract class AsInstances extends AnyRef
-
abstract
class
Is[A, B] extends Serializable
A value of
A Is B
is proof that the typesA
andB
are the same.A value of
A Is B
is proof that the typesA
andB
are the same. More powerfully, it asserts that they have the same meaning in all type contexts. This can be a more powerful assertion thanA =:= B
and is more easily used in manipulation of types while avoiding (potentially erroneous) coercions.A Is B
is also known as Leibniz equality. -
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 -
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
Value Members
- object As extends AsInstances with Serializable
- object Is extends Serializable