ContravariantCoyoneda

sealed abstract
class ContravariantCoyoneda[F[_], A]

Decomposition of fi.contramap(k) into its components, as it is frequently convenient to apply k separately from sorting or whatever process with fi, even when B is unknown, which is very common.

This is isomorphic to F as long as F itself is a contravariant functor. The homomorphism from F[A] to ContravariantCoyoneda[F,A] exists even when F is not a contravariant functor.

See ContravariantCoyonedaUsage.scala in the scalaz source tree for an interesting usage demonstration.

As ContravariantCoyoneda(o)(identity).unlift = o, further factoring can occur as follows, for free:

ContravariantCoyoneda(o contramap g)(f).unlift =
 ContravariantCoyoneda(o)(g compose f).unlift
See also
Companion
object
class Object
trait Matchable
class Any

Type members

Types

type I

The pivot between fi and k, usually existential.

The pivot between fi and k, usually existential.

Value members

Concrete methods

final
def contramap[B](f: B => A): Aux[F, B, I]

Simple function composition. Allows map fusion without touching the underlying F.

Simple function composition. Allows map fusion without touching the underlying F.

final
def run(implicit F: Contravariant[F]): F[A]

Converts to F[A] given that F is a contravariant.

Converts to F[A] given that F is a contravariant.

final
def trans[G[_]](f: NaturalTransformation[F, G]): Aux[G, A, I]

Natural transformation.

Natural transformation.

@inline
final
def unlift(implicit F: Contravariant[F]): F[A]

Alias for run.

Alias for run.

Abstract fields

val fi: F[I]

The underlying value.

The underlying value.

val k: A => I

The transformer function, to be lifted into F by run.

The transformer function, to be lifted into F by run.