I'm looking to see if there is a standard typeclass for a Bi-Functor that has one Contravariant parameter and one Covariant parameter.
punching the signature (c -> a) -> (b -> d) -> f a b -> f c d
results in nothing that matches.
Basically in Scala I'm looking to do:
trait CoContraBiFunctor[F[_, _]] {
def ccmap[A, B, C, D](fab: F[A, B])(f: C => A)(g: B => D): F[C, D]
}
implicit val ccFunction: CoContraBiFunctor[Function1] = new CoContraBiFunctor[Function] {
override def ccmap[A, B, C, D](fab: Function[A, B])(f: C => A)(g: B => D): Function[C, D] = new Function[C, D] {
override def apply(c: C): D = g(fab(f(c)))
}
}
Anyone have an idea? I definitely am not the first person to look for this.