Re:Monads are too powerful: The Expressiveness Spectrum
by 1718627440 on Wednesday October 15, 2025 @07:54PM
(#45599844)
Why does it sound so complicated when it is just a wrapper type that conforms to an interface?
Re:Monads are too powerful: The Expressiveness Spectrum
by ww520 on Wednesday October 15, 2025 @10:50PM
(#45600938)
It is what you described at high level. The devils are in the detail. People keep using words to describe the detail when code shows everything.
Re:Monads are too powerful: The Expressiveness Spectrum
by yobbo on Thursday October 16, 2025 @12:04AM
(#45601343)
It's a generalised typeclass for wrappers. It's not called "then" but "bind" and spelled (>>=), which doesn't exactly evoke useful associations for newcomers.
Re:Monads are too powerful: The Expressiveness Spectrum
by immibis on Thursday October 16, 2025 @09:15AM
(#45604948)
Because the interface has a few complicated rules associated with it. If you break them, the compiler may accept your code but it won't work with a lot of libraries that are supposed to work with any monad.
Example is best for illustration. I'll use a made-up syntax.
That's it! That's all to to monad. You can use the same pattern to build other monadic types, like List<T>, Promise<T>, IO<T>, as long as the wrap() and then() functions are built accordingly. Back to this example, to use it,