Types and Functions 4: Containers

Functor is simply an interface with a contract. We could have just as easily named it Mappable, but now, where’s the fun in that?

It would have been nice if the name was easy and logical but at least now I finally know what a Functor is. None of the other guides or tutorials really managed to explain that.

At the time of calling, a function can be surrounded by map, which transforms it from a non-functory function to a functory one, in informal terms. We call this process lifting. Functions tend to be better off working with normal data types rather than container types, then lifted into the right container as deemed necessary.

A decent explanation of lifting is also nice to have though without too many examples I don’t think this will stick.

The rest of the chapter including the introduction of IO is just one big: “Why would you do this?”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.