Could you give a brief code example how monads eliminates the problem of error handling? Do you mean to put try catch in the monad around every async step it takes in? Just the API for how this would even look would be great.
this is just a sketch to give you an idea of what I am talking about.
right well you've probably used jquery before, so the api would look something like this. You start with a sequence of async actions you want to perform.
Now this is a bit different from jQuery since all the methods here do is push method names and arguments onto a stack. it's the .end() method that reads in the stack and goes through and executes it. This means that each method along the way we've constructed a partial computation value- that is, the stack, which we can pass around as a value- just leave off the "end" method...
var scrapeHN = $(ctx).geturl("http://example.com).parseExample().renderTemplate();
now we can modify the computation by turning it into an error handling monad...
var ecm = ErrorCatchingMonad(scrapeHN, errorCallback);
this wraps each method in the monad with a try catch block, and calls the callback if an error gets thrown, and stops the chain from getting executed further. in fact this is how the origial monad was created
var $ = DeferringMonad(scrapingAPI);
which takes a normal jquery style plugin interface/chaining api and turns it into that deferring stack type api with an end(); method.