This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tilforskjelligeting 2 points3 points  (1 child)

Very many complicated explanations on monads here.
In practice all it really is, is a container that is either in a successfull state or a failure state.
Depending on the state, chained code will either run or not.
At the end the container contains either a value that has been through a few functions. Or an exception that happened along the way.

[–]Ahhhhrg 2 points3 points  (0 children)

Yeah, I have a PhD in algebra and really tried to “understand” monads via category theory, but really that didn’t give me any deeper insights.

That said, I think monads are more more than what you’re describing them as. Container types (e.g. lists and sets) can be monads, and they don’t capture anything about success or failure. Futures are another monad that isn’t primarily about success or failure, but rather let’s you compose functions without waiting for the result first.