• JavaScript deferreds are almost monads

    When I was learning monad concept from functional programming I suddenly realized that deferred objects avaiable in some JavaScript libraries (for example in Dojo - http://livedocs.dojotoolkit.org/dojo/Deferred) are strikingly similar to monads. Haskel has the clearest definition of the monads so let's start from it (don't get scarried, I'll explain essentials later): class Monad m where (>>=) :: m a -> (a -> m b) -> m b (>>) :: m a -> m b -> m b