Trait/Object

cats

ContravariantMonoidal

Related Docs: object ContravariantMonoidal | package cats

Permalink

trait ContravariantMonoidal[F[_]] extends ContravariantSemigroupal[F] with InvariantMonoidal[F] with Serializable

ContravariantMonoidal functors are functors that supply a unit along the diagonal map for the contramap2 operation.

Must obey the laws defined in cats.laws.ContravariantMonoidalLaws.

Based on ekmett's contravariant library: https://hackage.haskell.org/package/contravariant-1.4/docs/Data-Functor-Contravariant-Divisible.html

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ContravariantMonoidal
  2. InvariantMonoidal
  3. ContravariantSemigroupal
  4. Contravariant
  5. InvariantSemigroupal
  6. Invariant
  7. Semigroupal
  8. Serializable
  9. Serializable
  10. AnyRef
  11. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

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

    Permalink
    Definition Classes
    Contravariant
  2. abstract def product[A, B](fa: F[A], fb: F[B]): F[(A, B)]

    Permalink

    Combine an F[A] and an F[B] into an F[(A, B)] that maintains the effects of both fa and fb.

    Combine an F[A] and an F[B] into an F[(A, B)] that maintains the effects of both fa and fb.

    Example:

    scala> import cats.implicits._
    
    scala> val noneInt: Option[Int] = None
    scala> val some3: Option[Int] = Some(3)
    scala> val noneString: Option[String] = None
    scala> val someFoo: Option[String] = Some("foo")
    
    scala> Semigroupal[Option].product(noneInt, noneString)
    res0: Option[(Int, String)] = None
    
    scala> Semigroupal[Option].product(noneInt, someFoo)
    res1: Option[(Int, String)] = None
    
    scala> Semigroupal[Option].product(some3, noneString)
    res2: Option[(Int, String)] = None
    
    scala> Semigroupal[Option].product(some3, someFoo)
    res3: Option[(Int, String)] = Some((3,foo))
    Definition Classes
    Semigroupal
  3. abstract def unit: F[Unit]

    Permalink
    Definition Classes
    InvariantMonoidal

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. def compose[G[_]](implicit arg0: Contravariant[G]): Functor[[α]F[G[α]]]

    Permalink
    Definition Classes
    Contravariant
  7. def compose[G[_]](implicit arg0: Invariant[G]): Invariant[[α]F[G[α]]]

    Permalink
    Definition Classes
    Invariant
  8. def composeApply[G[_]](implicit arg0: Apply[G]): InvariantSemigroupal[[α]F[G[α]]]

    Permalink
    Definition Classes
    InvariantSemigroupal
  9. def composeContravariant[G[_]](implicit arg0: Contravariant[G]): Invariant[[α]F[G[α]]]

    Permalink
    Definition Classes
    Invariant
  10. def composeFunctor[G[_]](implicit arg0: Functor[G]): ContravariantSemigroupal[[α]F[G[α]]]

    Permalink
  11. final def eq(arg0: AnyRef): Boolean

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

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

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

    Permalink
    Definition Classes
    AnyRef → Any
  16. def imap[A, B](fa: F[A])(f: (A) ⇒ B)(fi: (B) ⇒ A): F[B]

    Permalink

    Transform an F[A] into an F[B] by providing a transformation from A to B and one from B to A.

    Transform an F[A] into an F[B] by providing a transformation from A to B and one from B to A.

    Example:

    scala> import cats.implicits._
    scala> import scala.concurrent.duration._
    scala> val durSemigroup: Semigroup[FiniteDuration] =
         | Invariant[Semigroup].imap(Semigroup[Long])(Duration.fromNanos)(_.toNanos)
    scala> durSemigroup.combine(2.seconds, 3.seconds)
    res1: FiniteDuration = 5 seconds
    Definition Classes
    ContravariantInvariant
  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. def liftContravariant[A, B](f: (A) ⇒ B): (F[B]) ⇒ F[A]

    Permalink
    Definition Classes
    Contravariant
  19. def narrow[A, B <: A](fa: F[A]): F[B]

    Permalink

    Lifts natural subtyping contravariance of contravariant Functors.

    Lifts natural subtyping contravariance of contravariant Functors. could be implemented as contramap(identity), but the Functor laws say this is equivalent

    Definition Classes
    Contravariant
  20. final def ne(arg0: AnyRef): Boolean

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

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

    Permalink
    Definition Classes
    AnyRef
  23. def point[A](a: A): F[A]

    Permalink

    point lifts any value into a Monoidal Functor.

    point lifts any value into a Monoidal Functor.

    Example:

    scala> import cats.implicits._
    
    scala> InvariantMonoidal[Option].point(10)
    res0: Option[Int] = Some(10)
    Definition Classes
    InvariantMonoidal
  24. final def synchronized[T0](arg0: ⇒ T0): T0

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

    Permalink
    Definition Classes
    AnyRef → Any
  26. def trivial[A]: F[A]

    Permalink

    trivial produces an instance of F for any type A that is trivial with respect to contramap2 along the diagonal

  27. final def wait(): Unit

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

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

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

Inherited from InvariantMonoidal[F]

Inherited from ContravariantSemigroupal[F]

Inherited from Contravariant[F]

Inherited from InvariantSemigroupal[F]

Inherited from Invariant[F]

Inherited from Semigroupal[F]

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped