# Functors

> Yet another design pattern from category theory in mathematics.

March 6, 2023 · 1 min read · https://yasint.dev/functors/
Tags: functional-programming, math

---

### Note to self

A Functor is a _design pattern_ that evolves from category theory in mathematics. Fundamentally it's a mapping between categories that preserves the structure of the original categories involved. It satisfies two laws: -

1. Identity law: $$\small{F(\operatorname{id}_A) = \operatorname{id}_{F(A)}}$$
2. Composition law: $$\small{F(g \circ f) = F(g) \circ F(f)}$$

### Reading list

- [Category Theory](https://plato.stanford.edu/entries/category-theory/)
- [Covariance and Contravariance](https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science))
- [Java Functors](https://www.baeldung.com/java-functors)
