News for hackers. Stuff that matters.
Re:A monad is a monoid in the category of endofunctors, what... by rmrfrmrf on Sunday February 10, 2019 @09:16AM (#19127833)
(The problem, in fact, is that the significance of monads in Haskell in terms of the side-effect model has nothing to do with category theory. The "side-effects" quite literally occur outside of these theoretical constructs.)
Re:A monad is a monoid in the category of endofunctors, what... by danidiaz on Sunday February 10, 2019 @09:52AM (#19127965)
The laws are important though. They ensure that the "statement-like" things we build out of expressions do behave like statements.

For example, it would be weird if we had three statements A B C that wrote to console, and sequencing A with B and then sequencing the result with C resulted in a different program than sequencing B with C and then sequencing A with the result.

Or, for non-IO things: it would be weird if we had three levels of nested lists, and concatenating two times "from the outside" resulted in a different list than concatenating each inner list first, and then the outer list.

Re:A monad is a monoid in the category of endofunctors, what... by zozbot123 on Sunday February 10, 2019 @03:26PM (#19129798)
On the contrary, the significance has everything to do with the category-theoretical pattern, albeit the reasoning for that is not immediately obvious and has to do with a further category-theoretical tool known as the Kleisli category. A monad with no enforced "outside" structure is known as a free monad, and is basically the equivalent of what most people outside FP call the Command pattern (or rather, a well-behaved version thereof). And "Commands" have everything to do with specifying side effects!
Re:A monad is a monoid in the category of endofunctors, what... by pwm on Sunday February 10, 2019 @03:33PM (#19129835)
The historical context helps here. Monads came to Haskell to deal with IO. Once there, people realised that a whole host of things are monads under the hood, most of which are pure. The word "effectful", somewhat confusingly, is often used for applicative/monadic code that is in fact pure under the hood. A good example is the State monad which does not mutate state in any way, it's completely pure computation that happens to model state.
Re:A monad is a monoid in the category of endofunctors, what... by mormegil on Monday February 11, 2019 @02:24AM (#19132637)
In other words, IO Monad Considered Harmful. https://blog.jle.im/entry/io-monad-considered-harmful.html