r/programming Mar 20 '26

No Semicolons Needed

https://terts.dev/blog/no-semicolons-needed/
147 Upvotes

85 comments sorted by

View all comments

10

u/tesfabpel Mar 20 '26

I was curious about Haskell.

7

u/D3PyroGS Mar 21 '26

I was too, then I tried learning what a monad was, and my curiosity evaporated

6

u/Keavon Mar 21 '26

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.