What Is A Functor?

Bartłomiej Żyliński
4 min readDec 27, 2022

Functor is a concept originating from mathematics, to be exact, from a part of mathematics called category theory. Here I will try to give you some more insight into Functors — what they are, how they work, and what the theory behind them is. I will also implement a simple Functor to better understand how they work and why using them may be a clearer solution.

Additionally as the Functor is the simplest functional container I will use this article as an entry point for new series.

The source code for this article is available in GitHub repository.

Why Even Care About Functors?

Firstly, Functors are probably the simplest of commonly known functional containers. Understanding their mechanics can help while working with more complex containers like Applicatives or Monads and greatly ease your journey deeper into functional programming.

Secondly, it is quite a handy concept, as in fact it is just a mapper and can be used in variety of places and situations. Finally, thanks to its laws Functor is especially helpful when you need to perform operations over some value inside the container.

It may come in handy someday and make your life easier.

What Is a Functor?

--

--