In the first post of this series we saw that there is a relationship between Array and PL, the category representing our programming language. In category theory, a functor is a mapping between categories. It matches the objects and arrows in one category with the objects and arrows in another.
Upon reading I found that the map function may be confusing. Based on the diagram you might think map is a function that takes an Array<Number> and turns it into an Array<String>. This is true in programming languages that provide a method called map on the functor type. But there is a method map and there is also a free function map that is unique to each functor. The free function map would take as input toString and have as output the function between Array<Number> to Array<String>.
Really great stuff.
Upon reading I found that the map function may be confusing. Based on the diagram you might think map is a function that takes an Array<Number> and turns it into an Array<String>. This is true in programming languages that provide a method called map on the functor type. But there is a method map and there is also a free function map that is unique to each functor. The free function map would take as input toString and have as output the function between Array<Number> to Array<String>.
Yes, you're right. What I'm showing in the diagram would be the output function that goes from Array<Number> to Array<String>.