πŸ“Contravariant Functor

tags
Β§ Category Theory

Contravariant functor is like a Functor, but it reverses the direction of morphisms. Contravariant functor from category CC to category DD is simply a Functor from CopC^{op} to DD.

Every arrow f:A→Bf: A \to B (in CC) is mapped to an arrow F(f):F(B)→F(A)F(f): F(B) \to F(A) (in DD).

Note that Cofunctor is a misnomer for contravariant functor, as the dual of a functor is a functor.

Haskelly-speaking:

class Contravariant f where
  contramap :: (a -> b) -> f b -> f a
  --      = :: (a -> b) -> (f b -> f a)
  -- must satisfy:
  -- contramap id = id
  -- contramap f . contramap g = contramap (g . f)

Backlinks

❦
Want to receive my πŸ–‹ posts as I publish them?