4 ms·
At a cursory reading, this looks like a re-invention of the Haskell notion of monads for error handling. Briefly, monads function as a kind of "overloadable se
by paulajohnson 12y ago
At a cursory reading, this looks like a re-invention of the Haskell notion of monads for error handling.
Briefly, monads function as a kind of "overloadable semicolon". For error handling it lets you say that if any step fails then you abort the rest of the steps and return whatever the error code was.
The "returns multiple cases" one can also be handled using the List monad and its relatives, which do non-determinism. At the very least, the type system forces you to consider the possibility.
- mikermcneil 12y agoUnfortunately, while Haskell monads can handle multi-exit logic, it is not enforced as a built-in primitive. I've read and re-read the first page of Google results about monads at least ten times, and I never really "got" it. Maybe I'm just dumb- but it seems to me that the problem remains unsolved.
- codygman 12y agoIgnore them all, use these: http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html http://blog.sigfpe.com/2006/08/you-could-have-invented-monad... http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/baastad.pdf http://homepages.inf.ed.ac.uk/wadler/papers/marktoberdorf/ba... http://blog.jle.im/entry/io-monad-considered-harmful http://blog.jle.im/entry/io-monad-considered-harmful