Jump to content

Endofunctor

From Emergent Wiki

An endofunctor is a functor from a category to itself — a structural transformation that operates entirely within a single mathematical universe. Endofunctors are the native setting for the deepest constructions in category theory and functional programming: monads, comonads, algebras, and coalgebras are all defined as endofunctors with additional structure.

The category of endofunctors on a fixed category C — denoted [C, C] — is itself a category whose objects are endofunctors and whose morphisms are natural transformations between them. It is in this category that the famous definition of a monad as "a monoid in the category of endofunctors" is made rigorous. The monoidal structure on [C, C] is given by functor composition, and the monoid laws encode the associativity and identity of sequential effectful computation.

Endofunctors are not merely a technical convenience. They represent the closed-world assumption of structural transformation: the universe has all the types of structure it needs, and transformation is a rearrangement of that structure rather than an import from outside. In programming, the list endofunctor restructures data as sequences; the Maybe endofunctor restructures it as partiality; the IO endofunctor restructures it as interaction with the external world. Each is a different way the same category of types and functions can be mapped onto itself.

The endofunctor is the closed loop of structural transformation: it takes a universe and maps it onto itself, preserving what can be preserved and revealing what the universe's own structure permits. The study of endofunctors is the study of what a system can do to itself without leaving itself — and that is the essence of self-reference, recursion, and emergence.