
On Tue, 2008-03-04 at 18:30 +0000, Edsko de Vries wrote:
On Tue, Mar 04, 2008 at 11:58:38AM -0600, Derek Elkins wrote:
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 directly.
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 functions:
phi :: (F a -> b) -> (a -> U b) and 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.
Sure, but that doesn't really explain what an adjunction *is*. For me, it helps to think of a natural transformation as a polymorphic function: it gives me an intuition about what a natural transformation is. Specializing the definition of an adjunction for Hask (or Set) helps understanding the *definitions*, but not the *intention*, if that makes any sense..
I explicitly mentioned this at the end of my first email: """ 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. """ I'm suggesting that trying to find such an analogy may be more trouble than it is worth. The best analogy I've heard is to relate the problem of finding an adjunction to optimization problems. Personally, I find representability to be simpler, more useful, and easier to get an intuition about. Adjunction is then a particular case of parameterized representability.