Trait/Object

zio.prelude

Covariant

Related Docs: object Covariant | package prelude

Permalink

trait Covariant[F[+_]] extends CovariantSubset[F, AnyType] with Invariant[F]

Covariant[F] provides implicit evidence that F[+_] is a covariant endofunctor in the category of Scala objects.

Covariant instances of type F[A] "produce" values of type A in some sense. In some cases, such as with a List[A], this means that they contain values of type A, in which case we can simply access the elements of the collection. In other cases it means that output values of type A which may not already exists, such as with a Function0[A] that produces A 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 a map 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 a List[String] and a function String => Int that returns the length of a string, then we can construct a List[Int] with the length of each string.

Self Type
Covariant[F]
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Covariant
  2. Invariant
  3. CovariantSubset
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def map[A, B](f: (A) ⇒ B): (F[A]) ⇒ F[B]

    Permalink

    Lift a function from A to B to a function from F[A] to F[B].

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def compose[G[-_]](implicit g: Contravariant[G]): Contravariant[[-A]F[G[A]]]

    Permalink

    Compose covariant and contravariant functors.

  7. final def compose[G[+_]](implicit g: Covariant[G]): Covariant[[+A]F[G[A]]]

    Permalink

    Compose two covariant functors.

  8. final def compose[G[_]](implicit g: Invariant[G]): Invariant[[A]F[G[A]]]

    Permalink

    Compose two invariant functors.

    Compose two invariant functors.

    Definition Classes
    Invariant
  9. def compositionLaw[A, B, C](fa: F[A], f: <=>[A, B], g: <=>[B, C])(implicit equal: Equal[F[C]]): Boolean

    Permalink
    Definition Classes
    Invariant
  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def fproduct[A, B](f: (A) ⇒ B): (F[A]) ⇒ F[(A, B)]

    Permalink
  14. def fproductLeft[A, B](f: (A) ⇒ B): (F[A]) ⇒ F[(B, A)]

    Permalink
  15. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  17. def identityLaw1[A](fa: F[A])(implicit equal: Equal[F[A]]): Boolean

    Permalink
    Definition Classes
    Invariant
  18. final def invmap[A, B](f: <=>[A, B]): <=>[F[A], F[B]]

    Permalink
    Definition Classes
    CovariantInvariant
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. final def mapSubset[A, B](f: (A) ⇒ B)(implicit arg0: AnyType[B]): (F[A]) ⇒ F[B]

    Permalink
    Definition Classes
    CovariantCovariantSubset
  21. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  25. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Invariant[F]

Inherited from CovariantSubset[F, AnyType]

Inherited from AnyRef

Inherited from Any

Ungrouped