final case classBinested[F[_, _], G[_], H[_], A, B](value: F[G[A], H[B]]) extends Product with Serializable
Compose a two-slot type constructor F[_, _] with two single-slot type constructors
G[_] and H[_], resulting in a two-slot type constructor with respect to the inner types.
For example, List and Option both have Functor instances, and Either has a
Bifunctor instance. Therefore, Binested[Either, List, Option, ?, ?] has a Bifunctor
instance as well:
scala> import cats.Bifunctor
scala> import cats.data.Binested
scala> import cats.implicits._
scala> val eitherListOption: Either[List[Int], Option[String]] = Right(Some("cats"))
scala> val f: Int=>String = _.toString
scala> val g: String=>String = _ + "-bifunctor"
scala> val binested = Binested(eitherListOption)
scala> val bimapped = Bifunctor[Binested[Either, List, Option, ?, ?]].bimap(binested)(f, g).value
res0: Either[List[String], Option[String]] = Right(Some("cats-bifunctor"))
Compose a two-slot type constructor
F[_, _]
with two single-slot type constructorsG[_]
andH[_]
, resulting in a two-slot type constructor with respect to the inner types. For example,List
andOption
both haveFunctor
instances, andEither
has aBifunctor
instance. Therefore,Binested[Either, List, Option, ?, ?]
has aBifunctor
instance as well: