Search⌘ K
AI Features

Functors

Learn to understand functors in Python functional programming. Discover how functors like Just, Nothing, and List wrap values and how to apply functions to them using map and special operators.

What are functors?

We need to be a little careful, as the term functor has different meanings in different branches of computing. For example, it is sometimes used simply to refer to a function object. That is not what we mean here.

If you are familiar with the Haskell programming language, oslash functors are based closely on those.

A functor is an object that wraps a value and provides a map method that can be used to apply a function to that value.

Most of the functors we discuss in this section are also ...