Functional Programmingtoday !
And let's start by the easiest one:Functor.
You might have heard aboutMonad,Monoid,Applicative, etc…
In this episode, we are focusing on theFunctor.
The formal definition for aFunctoris a transformation from a categoryAto a categoryB. Such transformations are often represented by an arrow:A -> B.
This transformation, in Scala, is translated to the methodmapthat we have seen a lot in the past.
AFunctor(F), in category theory, must follow several rules:
Amust have a result inBid, the identity method:id(a) == a,id(F) == F.map(id).fandg, 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.