The two meanings are unrelated.
The Haskell community (and really the Functional Programming community in general, and even the general programming community beyond FP) uses the term Functor in the sense of Category Theory. That's the same branch of mathematics where also the concepts of Monads, Duality, Arrows, and many other come from.
The C++ community is one of only a few programming communities that does not use this meaning. There, as you correctly identified, it simply means an object that has an operator ()
, and as such is comparable to a callable in Python, an object with an apply
method in Scala, or an object which responds to a call
message in Ruby.
Another example is Standard ML, where a Functor is a concept in its Module System representing the concept of Parametric Modules: SML's module system consists of Structures (which other module systems would call "module implementations"), Signatures (which is just what it sounds like: the public module interface specification), and Functors (kind of like module-level functions from structures to structures, similar to how a type constructor ("generic" if you speak Java or C#) is kind of like a type-level function from types-to-types). So, Functors are how SML does Parametric Modules which is something that not many module systems have.
They are sorta related to the Category Theoretical notion.
The term also exists in Prolog, but I don't know much about Prolog, so I will just leave you with this:
In Prolog, the word functor is used to refer to the atom at the start of a structure, along with its arity, that is, the number of arguments it takes.
[…]
The term functor is used in a different sense in mathematics and in functional programming, and a different way again in philosophy.
[Source: http://www.cse.unsw.edu.au/~billw/dictionaries/prolog/functor.html]
Functor
do feel more like fungends than functors to me.