While programming in Scala we often come across a term called Functor. A functor is an extremely simple but powerful concept. In this blog, let us discuss that in more detail.
Theoretically functor is a type of mapping between categories. Given two categories A and B, a functor F maps the objects or entities of A to objects or entities of B. We can simply call it a function of objects or entities.
In programming the functors come into play when we have types or values wrapped inside context or containers. This wrapping up inside context, blocks application of normal functions on the values. This happens because the result on application of function is dependent on the context.
The solution to above scenario is a function that knows how to apply functions to the values wrapped in a context. Internally speaking this function should have a potential to
- unwrap(fetch) the value…
View original post 265 more words