[Haskell-cafe] Functor and Haskell

wren ng thornton wren at freegeek.org
Fri Apr 24 04:30:22 EDT 2009

Daryoush Mehrtash wrote:
> Thanks this was helpful.
> In many of Conal Elliot's writings I see that he shows that his semantic
> function is a natural transformation.  Is that just basically showing the
> polymorphic nature of his semantic functions, or are there other benifits
> you get by showing a particular function is a natural transformation?
> Daryoush

Natural transformations give you a lot of very regular structure to work 
with. This is helpful down the road when trying to prove other laws, 
e.g. about how your thing (that happens to be a NT) interacts with other 
things. For example, the catamorphism fusion law:

     eps : F :~> G
     cata_G psi . cata_F (in_G . eps) = cata_F (psi . eps)

Because eps is a natural transformation we know that it can't be doing 
any of the bad things that would violate the equation.

Often times when trying to prove something non-trivial you find yourself 
wishing "if only I had a very well-behaved morphism to go here". The 
components of NTs are frequently the exact thing you want there.

Live well,

More information about the Haskell-Cafe mailing list