Learning Functors and Categories
Please bear with me as I explain some theoretical context before we go back to play with the code. Alternatively, feel free to skip ahead and review our approach to error handling in the code (Using Functors to Handle Errors) before returning to this section for the theory.
Understanding functors well is a critical step in mastering advanced functional programming. If you fully understand them, you won’t have any problems with more complex structures like monads and applicatives, which we’ll look at in the next chapters.
To define what a functor is, we need to look first at what a category is. A category is a mathematical concept introduced to define the relation between things in the most abstract way possible. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access