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

Kim-Ee Yeoh a.biurvOir4 at asuhan.com
Thu Mar 6 00:22:44 EST 2008



ajb-2 wrote:
> 
> In Haskell, natural transformations are
> functions that respect the structure of functors.  Since you can't
> avoid respecting the structure of functors (the language won't let you
> do otherwise), you get natural transformations for free. (Free as 
> in theorems, not free as in beer.)
> 

It's worth noting that polymorphism is one of those unavoidable,
albeit hidden, functors. Polymorphizing a function "forall a" can 
be thought of as lifting it via the ((->) T_a) functor, where T_a
is the type variable of "a". E.g. reverse really has the signature
T_a -> [a] -> [a].

But ((->) T_a) is left adjoint to ((,) T_a), which just happens
to be the analogous type-explicit way of representing existentials.

Adjunctions are a useful tool to describe and analyze such
dualities precisely.


ajb-2 wrote:
> 
> Adjunctions, on the other hand, you have to make yourself.  As such,
> they're more like monads.
> 

Constructing adjunctions, comprising as they do of a pair of 
functors, does seem double the work of a single monad. Duality
OTOH is a powerful guiding principle and may well be easier than
working with the monad laws directly. 

And besides, you get a comonad for free.


ajb-2 wrote:
> 
> One thing that springs to mind is that an adjunction could connect
> monads and their associated comonads.  Is that a good picture?
> 

Definitely.

-- 
View this message in context: http://www.nabble.com/Functional-programmer%27s-intuition-for-adjunctions--tp15832225p15866753.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list