Abstract Value Members
-
abstract
def
map[A, B](f: (A) ⇒ B): (F[A]) ⇒ F[B]
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
compose[G[-_]](implicit g: Contravariant[G]): Contravariant[[-A]F[G[A]]]
-
final
def
compose[G[+_]](implicit g: Covariant[G]): Covariant[[+A]F[G[A]]]
-
final
def
compose[G[_]](implicit g: Invariant[G]): Invariant[[A]F[G[A]]]
-
def
compositionLaw[A, B, C](fa: F[A], f: <=>[A, B], g: <=>[B, C])(implicit equal: Equal[F[C]]): Boolean
-
-
-
def
finalize(): Unit
-
def
fproduct[A, B](f: (A) ⇒ B): (F[A]) ⇒ F[(A, B)]
-
def
fproductLeft[A, B](f: (A) ⇒ B): (F[A]) ⇒ F[(B, A)]
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
def
identityLaw1[A](fa: F[A])(implicit equal: Equal[F[A]]): Boolean
-
final
def
invmap[A, B](f: <=>[A, B]): <=>[F[A], F[B]]
-
final
def
isInstanceOf[T0]: Boolean
-
final
def
mapSubset[A, B](f: (A) ⇒ B)(implicit arg0: AnyType[B]): (F[A]) ⇒ F[B]
-
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Covariant[F]
provides implicit evidence thatF[+_]
is a covariant endofunctor in the category of Scala objects.Covariant instances of type
F[A]
"produce" values of typeA
in some sense. In some cases, such as with aList[A]
, this means that they contain values of typeA
, in which case we can simply access the elements of the collection. In other cases it means that output values of typeA
which may not already exists, such as with aFunction0[A]
that producesA
values when invoked.Common examples of covariant instances in ZIO includes effects with respect to their error and value types, sinks with respect to their error and output types, and queues and references with respect to their error and output types.
Covariant
instances support amap
operation which allows transforming the output type given a function from the old output type to the new output type. For example, if we have aList[String]
and a functionString => Int
that returns the length of a string, then we can construct aList[Int]
with the length of each string.