| >and in such a case a -> f a might not make any sense because there are no morphisms between categories In CAT the category of small categories objects are categories and morphisms are functors. Haskell types can be thought of as a small categories so I don't think this statement is correct? I'm no expert but can you clarify, the definition on wikipedia says that functors are morphisms between categories in CAT. >There might not be a corresponding morphism between "a" and "f a". Hmm. if haskell types make up a small category that means 'a' and 'f a' are sets. I can't imagine a case where two sets cannot have a mapping between them. Can you give a specific example? >The typeclass you created would be a functor along with a natural transformation from the identity functor to f. I'm confused about this. Isn't the natural transformation from identity to another category (at least for small categories) equivalent to a functor? In my head they look identical. https://en.wikipedia.org/wiki/Natural_transformation If you look at the commutative diagram on this page and replace F(X) and G(X) with identity X and G the natural transformation diagram looks just like a diagram for a functor. btw I'm not an expert in haskell (let alone agda) or category theory so forgive me if the stuff I talk about is totally off. |
It is true that functors are morphisms between categories, but that's a morphism in CAT.
> I'm confused about this.
That's how these things go :-) Anyway, natural transformations are between two functors C -> D. This is an example of a 2-morphism in a 2-category. It's hard to come up with something to say other than they're just different, but think about this: a natural transformation is a consistent choice of morphisms F X -> G X (in D) for each object X (in C), but a functor needs to know where the morphisms of C go, too.
(An intuition is a natural transformations is kind of like a continuous path transforming one functor into another. This might just make things confusing, though.)