Functional Programming today !
And let's start by the easiest one: Functor.
You might have heard about Monad, Monoid, Applicative, etc…
In this episode, we are focusing on the Functor.
The formal definition for a Functor is a transformation from a category
A to a category
B. Such transformations are often represented by an arrow:
A -> B.
This transformation, in Scala, is translated to the method
map that we have seen a lot in the past.
A Functor (
F), in category theory, must follow several rules:
Amust have a result in
id, the identity method:
id(a) == a,
id(F) == F.map(id).
g, two methods,
F.map(f).map(g) == F.map( g(f(_)) ).
In the following episode, we are going to learn more about the other component of the category theory ecosystem and functional programming overall.