News for hackers. Stuff that matters.
Re:Monads are too powerful: The Expressiveness Spectrum by gowld on Wednesday October 15, 2025 @06:27PM (#45599064)
The important thing to know first is that a monad is not a single thing like "Optional". "monad" is a pattern or "interface" (called a "typeclass" in Haskell), that has many implementations, (Optional, Either, List, State Transormer, IO (Input/Output), Logger, Continuation, etc). Sort of how "Visitor" pattern in C++/Java is not a single thing.

https://hackage.haskell.org/package/base-4.21.0.0/docs/Contr...

https://book.realworldhaskell.org/read/monads.html

A common metaphor for monad is "executable semicolons". They are effectively a way to add (structured) hook computations (that always returns a specific type of value) to run every time a "main" computation (akin to a "statement" in other languages) occurs "in" the monad.

It's sort of like a decorator in Python, but more structured. It lets you write a series of simple computational steps (transforming values), and then "dress them up" / "clean them up" by adding a specific computation to run after each step.

Re:Monads are too powerful: The Expressiveness Spectrum by tickettotranai on Wednesday October 15, 2025 @07:42PM (#45599733)
Somehow I hear this all the time, but the haskell people have to realize that code patterns are absolutely a thing in all languages, ever? A lack of syntactic sugar doesn't mean monads don't exist in other languages.

Typeclasses are a distraction, the point is computation ignoring annoying contexty stuff (file not found errors, null on failure, etc) and there's dozens of examples in literally every language ever.

Not all problems are solved with a technical definition.

Re:Monads are too powerful: The Expressiveness Spectrum by tome on Thursday October 16, 2025 @02:52AM (#45602181)
> the haskell people have to realize that code patterns are absolutely a thing in all languages, ever? A lack of syntactic sugar doesn't mean monads don't exist in other languages.

Where did you get the impression that Haskell people don't realize that code patterns are a thing in other languages, or that monads don't exist in other languages?

Besides the syntactic sugar of "do notation", what Haskell has that most other languages don't have is the ability to abstract over monads, since it has higher kinded types. That is, you can write a generic operation like

    mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
that works for all monads. Most other type languages force you to write mapM separately for each monad you want it to work with.
Re:Monads are too powerful: The Expressiveness Spectrum by Ryder123 on Wednesday October 15, 2025 @06:31PM (#45599111)
This makes SchemaLoad's comment perfectly clear.

(but do I appreciate the effort you put into your reply - reading that monad's are more like interfaces is new information to me, and might help down the road)