sealed abstract class As[-A, +B] extends Serializable
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
- Source
- As.scala
- Alphabetic
- By Inheritance
- As
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
substitute[F[-_]](p: F[B]): F[A]
Use this subtyping relationship to replace B with a value of type A in a contravariant context.
Use this subtyping relationship to replace B with a value of type A in a contravariant context. This would commonly be the input to a function, such as F in:
type F[-B] = B => String
. In this case, we could use A As B to turn an F[B] Into F[A].
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
andThen[C](that: As[B, C]): As[A, C]
- Annotations
- @inline()
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
final
def
coerce(a: A): B
- Annotations
- @inline()
-
final
def
compose[C](that: As[C, A]): As[C, B]
- Annotations
- @inline()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
toPredef: <:<[A, B]
A value
A As B
is always sufficient to produce a similarPredef.<:<
value.A value
A As B
is always sufficient to produce a similarPredef.<:<
value.- Annotations
- @inline()
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )