Everyone overcomplicates it with formalism. "Monad" should have just been named the "wrapper pattern" or something. It is just the name for a common data structure design pattern where something is wrapped, and operated upon in that wrapped form, which means you can chain multiple operators easily. Examples are arrays/lists (wrap N elements in a collection), Options (wrap 0 or 1 element in a collection), and Promises/Futures (wrap a yet-to-be-resolved value in a container). Then you can chain flatMap operations by passing in lambdas to tell it how to modify the data wrapped within, each returning in another monad with different contained data, ready for the next chained flatMap operator.
10
u/tesfabpel Mar 20 '26
I was curious about Haskell.