3 ms·
" think people are looking for something profound where there really isn't anything as profound as they are imagining. " I largely agree with what you (jrockwa
by plinkplonk 17y ago
" think people are looking for something profound where there really isn't anything as profound as they are imagining. "
I largely agree with what you (jrockway) say, but differ in some nuances. These "concepts + laws" seem to be best understood as mathematical constructs (like say functions or sets) than analogies. What I think is happening now is people are trying to understand Sets by studying say java.util.HashSet, or even worse, analogies to java.util.HashSet.
"Functors are containers that can apply a function ("fmap") to their contents."
This is true enough, but it is hard to understand the ((->) r) functor (for example) as a container. You can do it but you have to stretch a bit. I have seen people struggle with understanding IO as a container.
Wheras if you know that a functor maps (or transforms) objects (in the cCategory Theory sense, not in the OO sense) to objects ,and morphisms to morphisms, subject to 3 laws, then it makes perfect sense that ((->) r) is a functor. Likewise with IO.
The key this is to understand the Hask category where types are objects and functions are morphisms.
For a Haskell functor, the type constructor takes care of the "objects to objects" (or type to type) mapping and the first order function (map for lists for example, or compose for the ((-> r) and so on) take care of the morphism to morphism (here, functions to functions) mapping.
And it is not even very hairy math. The definition of a category is hardly half a page of prose, much easier to understand than some specs we programmers work off of.
@jrockway, do you want to write that book? :-)