↓ Skip to main content

Types and Functions 4: Containers

·154 words

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?”

Alper Cugun
Author
Alper Cugun

Related

Types and Function 5: Monads

·303 words
I’m looking forward to this chapter. When they taught us Haskell as an undergrad they made sure to stop well short of Monads. At the time I was happy about that but by now I wish we had pushed on.

·27 words
A concretized framework for making better product decisions by Laura Klein that comes down to: get together, write things down, review things, course correct when required.

·16 words
A bunch of incredibly grim stories of people whose lives were destroyed in the DDR.