# The Category Theory

Learn about category theory in functional programming.

## We'll cover the following

## Overview of functors

Functors have, or are at least spoken of in such a way as to convey, an air of complexity. In practice, however, they
are rather powerful artifacts at the heart of which is a map operation not too different from the one described earlier. **Functors** are efficient chaining structures from which monads are derived. Understanding the concepts that make them the efficient objects they are, requires combining knowledge of category theory with a practical understanding of the functional programming paradigm as a whole. The misconception that functors are exceedingly arcane could not be further from the truth: this chapter attempts to disprove it.

## A crash course in category theory

In mathematics, problem solving usually takes the form of either generalization or abstraction. **Generalizing** means starting with a solution adapted for a few contexts and expanding its scope and making it viable for other problems. PHP’s programming paradigm has been generalized to include functional, object-oriented, and even asynchronous approaches, making it a viable multi-purpose or general-purpose language.

**Abstraction**, on the other hand, involves tidying away a pattern adaptable to similar situations. It renders a solution that’s usable for different invariants. Abstractions and blueprints have a point in common. That is, they’re both reusable resources. Numbers are an abstraction that allows us to count in different bases.

**Category theory** is a system of useful generalizations and abstractions in mathematics. It takes a taxonomical approach to mathematics, with many similarities to programming.

### Defining category theory

The programmatic and mathematical paradigms overlap in many places. One overlap is noticeable through category theory. A **category** is a set of objects and the arrows between them. Object contents aren’t the primary focus of category theory, because they’re abstractions. An object could be a representation of any number of mathematically viable ideas. **Arrows**, on the other hand, are the mappings between objects (also referred to as morphisms). They represent abstract object-to-object transformations.

Get hands-on with 1200+ tech skills courses.