[Haskell-cafe] Functional programmer's intuition for adjunctions?

Derek Elkins derek.a.elkins at gmail.com
Tue Mar 4 12:58:38 EST 2008

On Tue, 2008-03-04 at 17:16 +0000, Edsko de Vries wrote:
> Hi,
> Is there an intuition that can be used to explain adjunctions to
> functional programmers, even if the match isn't necessary 100% perfect
> (like natural transformations and polymorphic functions?).

Well when you pretend Hask is Set, many things can be discussed fairly

F is left adjoint to U, F -| U, if Hom(FA,B) is naturally isomorphic to
Hom(A,UB), natural in A and B.  A natural transformation over Set is
just a polymorphic function. So we have an adjunction if we have two

phi :: (F a -> b) -> (a -> U b)
phiInv :: (a -> U b) -> (F a -> b)

such that phi . phiInv = id and phiInv . phi = id and F and U are
instances of Functor.

The unit and counit respectively is then just phi id and phiInv id.

You can work several examples using this framework, though it gets
difficult when it is difficult to model other categories.

Also discussing and proving some properties of adjunctions (namely
continuity properties) would help.

Of course, this is a concrete example using basic ideas of programming
and not some "intuitive analogy".  I feel comfortable working with
adjunctions, but I don't have some general analogy that I use.

More information about the Haskell-Cafe mailing list