Haskell Language Functor

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!


Functor is the class of types f :: * -> * which can be covariantly mapped over. Mapping a function over a data structure applies the function to all the elements of the structure without changing the structure itself.


A Functor can be thought of as a container for some value, or a computation context. Examples are Maybe a or [a]. The Typeclassopedia article has a good write-up of the concepts behind Functors.

To be considered a real Functor, an instance has to respect the 2 following laws:


fmap id == id


fmap (f . g) = (fmap f) . (fmap g)

Got any Haskell Language Question?