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).
- Understanding map and apply. A toolset for working with elevated worlds.
- Understanding bind. Or, how to compose world-crossing functions.
- Using the core functions in practice. Working with independent and dependent data.
- Understanding traverse and sequence. Mixing lists and elevated values.
- Using map, apply, bind and sequence in practice. A real-world example that uses all the techniques.
- Reinventing the Reader monad. Or, designing your own elevated world.
- Map and Bind and Apply, a summary. .