Wander

trait Wander[P[_, _]] extends Strong[P] with Choice[P]

Class for profunctors that support polymorphic traversals

Companion:
object
trait Choice[P]
trait Strong[P]
trait Profunctor[P]
class Object
trait Matchable
class Any

Value members

Abstract methods

def wander[S, T, A, B](traversing: Traversing[S, T, A, B])(pab: P[A, B]): P[S, T]

Inherited methods

def dimap[A, B, C, D](fab: P[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.implicits._
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
Inherited from:
Profunctor
def first[A, B, C](fa: P[A, B]): F[(A, C), (B, C)]

Create a new F that takes two inputs, but only modifies the first input

Create a new F that takes two inputs, but only modifies the first input

Example:

scala> import cats.implicits._
scala> import cats.arrow.Strong
scala> val f: Int => Int = _ * 2
scala> val fab = Strong[Function1].first[Int,Int,Int](f)
scala> fab((2,3))
res0: (Int, Int) = (4,3)
Inherited from:
Strong
def left[A, B, C](pab: P[A, B]): P[Either[A, C], Either[B, C]]
Inherited from:
Choice
def leftNarrow[A, B, AA <: A](fab: P[A, B]): F[AA, B]

Narrows A into a subtype AA. Example:

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
Inherited from:
Profunctor
def lmap[A, B, C](fab: P[A, B])(f: C => A): F[C, B]

contramap on the first type parameter

contramap on the first type parameter

Inherited from:
Profunctor
def right[A, B, C](pab: P[A, B]): P[Either[C, A], Either[C, B]]
Inherited from:
Choice
def rightWiden[A, B, BB >: B](fab: P[A, B]): F[A, BB]

Widens B into a supertype BB. Example:

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
Inherited from:
Profunctor
def rmap[A, B, C](fab: P[A, B])(f: B => C): F[A, C]

map on the second type parameter

map on the second type parameter

Inherited from:
Profunctor
def second[A, B, C](fa: P[A, B]): F[(C, A), (C, B)]

Create a new F that takes two inputs, but only modifies the second input

Create a new F that takes two inputs, but only modifies the second input

Example:

scala> import cats.implicits._
scala> import cats.arrow.Strong
scala> val f: Int => Int = _ * 2
scala> val fab = Strong[Function1].second[Int,Int,Int](f)
scala> fab((2,3))
res0: (Int, Int) = (2,6)
Inherited from:
Strong