The "Map and Bind and Apply, Oh my!" series
In this series of posts, I’ll attempt to describe some of the core functions for dealing with generic data types (such as Option
and List
).
This is a follow-up post to my talk on functional patterns.
Yes, I know that I promised not to do this kind of thing, but for this post I thought I’d take a different approach from most people. Rather than talking about abstractions such as type classes, I thought it might be useful to focus on the core functions themselves and how they are used in practice.
In other words, a sort of “man page” for map
, return
, apply
, and bind
.
So, there is a section for each function, describing their name (and common aliases), common operators, their type signature, and then a detailed description of why they are needed and how they are used, along with some visuals (which I always find helpful).
-
1. Understanding map and apply
A toolset for working with elevated worlds -
2. Understanding bind
Or, how to compose world-crossing functions -
3. Using the core functions in practice
Working with independent and dependent data -
4. Understanding traverse and sequence
Mixing lists and elevated values -
5. Using map, apply, bind and sequence in practice
A real-world example that uses all the techniques -
6. Reinventing the Reader monad
Or, designing your own elevated world -
7. Map and Bind and Apply, a summary