How to Write a Functor in Elixir
There’s a function called Enum.map in Elixir that works on multiple collection types, but it's not without its issues. In this post, I will introduce you to a concept from functional programming called a functor. We’ll make a Functor protocol with a function called fmap that will aspire to be a better version of Enum.map. Note: The article is inspired by the Witchcraft library, which we covered in one of our previous posts. But first: what's the problem with Enum.map exactly?