Understanding how Either is an instance of Functor

This is right. There is also another quite important reason for this behavior: You can think of Either a b as a computation, that may succeed and return b or fail with an error message a. (This is also, how the monad instance works). So it’s only natural, that the functor instance won’t touch the Left values, since you want to map over the computation, if it fails, there’s nothing to manipulate.

Leave a Comment