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 Is, which declares that A is the same type as B.
A flipped alias, for those used to their arrows running left to right
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/As.scala
The original contribution to scalaz came from Jason Zaugg
A value of A Is B
is proof that the types A
and B
are the same.
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.
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
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