The quintessential method of the Bifunctor trait, it applies a function to each "side" of the bifunctor.
The quintessential method of the Bifunctor trait, it applies a function to each "side" of the bifunctor.
Example:
scala> import cats.implicits._ scala> val x: (List[String], Int) = (List("foo", "bar"), 3) scala> x.bimap(_.headOption, _.toLong + 1) res0: (Option[String], Long) = (Some(foo),4)
The composition of two Bifunctors is itself a Bifunctor
apply a function to the "left" functor
Widens A into a supertype AA.
Widens A into a supertype AA. Example:
scala> import cats.implicits._ scala> sealed trait Foo scala> case object Bar extends Foo scala> val x1: Either[Bar.type, Int] = Either.left(Bar) scala> val x2: Either[Foo, Int] = x1.leftWiden
A type class of types which give rise to two independent, covariant functors.