Get the latest tech news

A list is a monad


The term “monad” is often invoked when describing patterns in functional programming. Yet explanations typically swing between high-level metaphors and deep mathematical abstractions. Each approach offers part of the picture, intuition without precision, or rigor without intuition but seldom both.

At the heart of monadic programming is the idea that you write one function, say, f(x) = x + 1, and then reuse it across different contexts without rewriting control-flow logic. Unit moves a raw value into the monadic context, sometimes called “lifting”, “identity”, “return”, “wrap”, or “promotion”, or some fancy operation names like “liftM” or “liftA”. With flatMap, you both apply your lookup and collapse the layers in one go, so you can seamlessly sequence optional, error-handling, or asynchronous operations (e.g. promises/tasks) without ever wrestling with nested monadic types.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of list

list

Photo of Monad

Monad

Related news:

News photo

Apple celebrates 20 years of podcasts with a list of fan favorites

News photo

Tesla's Robotaxis keep screwing up. There's now a list of incidents.

News photo

Apple is releasing iOS 26 this fall. Here's the full list of compatible iPhones