IsContravariant

trait IsContravariant[F[_]]

Type constructors that are contravariant with respect to subtyping.

A type constructor F[_] admits an instance IsContravariant[F] iff F[B] is a subtype of F[A] whenever A is a subtype of B.

The Scala language represents this natively using the [-A] notation on type constructors. The factory scalaContravariant provides an instance of this typeclass for any such type. However, type constructors which behave contravariantly despite not being thus notated can also implement this typeclass. The factory force constructs an instance of IsContravariant for any type, based on the programmer's assertion that it is indeed contravariant.

Note the relationship between this typeclass and Contravariant: whereas Contravariant instances are contravariant functors in the "category" of Scala types and functions, instances of this typeclass are contravariant functors in the "category" of Scala types and subtyping relations.

Companion
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def liftLiskovCt[A, B](implicit ev: Liskov[A, B]): Liskov[F[B], F[A]]

Concrete methods

def narrow[A, B](fa: F[B])(implicit ev: Liskov[A, B]): F[A]
def substCo[G[_], A, B](g: G[F[B]])(implicit ev: Liskov[A, B]): G[F[A]]
def substCt[G[_], A, B](g: G[F[A]])(implicit ev: Liskov[A, B]): G[F[B]]