trait Profunctor[F[_, _]] extends Serializable
A Profunctor is a Contravariant functor on its first type parameter and a Functor on its second type parameter.
Must obey the laws defined in cats.laws.ProfunctorLaws.
- Self Type
- Profunctor[F]
- Source
- Profunctor.scala
- Alphabetic
- By Inheritance
- Profunctor
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def dimap[A, B, C, D](fab: F[A, B])(f: (C) => A)(g: (B) => D): F[C, D]
Contramap on the first type parameter and map on the second type parameter
Contramap on the first type parameter and map on the second type parameter
Example:
scala> import cats.syntax.all._ scala> import cats.arrow.Profunctor scala> val fab: Double => Double = x => x + 0.3 scala> val f: Int => Double = x => x.toDouble / 2 scala> val g: Double => Double = x => x * 3 scala> val h = Profunctor[Function1].dimap(fab)(f)(g) scala> h(3) res0: Double = 5.4
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 asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def leftNarrow[A, B, AA <: A](fab: F[A, B]): F[AA, B]
Narrows A into a subtype AA.
Narrows A into a subtype AA. Example:
scala> import cats.syntax.profunctor._ scala> import cats.instances.function._ scala> scala> sealed trait Foo scala> case object Bar extends Foo scala> val x1: Foo => Int = _ => 1 scala> val x2: Bar.type => Int = x1.leftNarrow
- def lmap[A, B, C](fab: F[A, B])(f: (C) => A): F[C, B]
contramap on the first type parameter
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def rightWiden[A, B, BB >: B](fab: F[A, B]): F[A, BB]
Widens B into a supertype BB.
Widens B into a supertype BB. Example:
scala> import cats.syntax.profunctor._ scala> import cats.instances.function._ scala> scala> sealed trait Foo scala> case object Bar extends Foo scala> val x1: Int => Bar.type = _ => Bar scala> val x2: Int => Foo = x1.rightWiden
- def rmap[A, B, C](fab: F[A, B])(f: (B) => C): F[A, C]
map on the second type parameter
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()