News for hackers. Stuff that matters.
Re:Monads for Normal Programmers by jayferd on Friday February 08, 2013 @02:06PM (#5189532)
Uh, these are not monads. These are actually what we might call "wrappers". They just provide a nicer interface for an underlying API (the DOM in jQuery's case, and sql queries in Django's).

What is a monad is JQuery.Deferred, with the `.then(...)` method as the `bind` operator. This has to be monadic, because it wraps a promise of a value that can't be computed synchronously.

Re:Monads for Normal Programmers by MostAwesomeDude on Friday February 08, 2013 @03:34PM (#5189965)
More interestingly, the original Deferred, from the Twisted networking library, is a monad and an arrow, and it passes the monad laws.
Re:Monads for Normal Programmers by Peaker on Friday February 08, 2013 @05:02PM (#5190389)
It is similar to a Monad, but not quite, because the "bind" (addCallback) mutates it inplace, and does not return a chained operation. Also because if your callback's return value is itself again a Deferred, it will flatten it out. That means it "auto-joins" on the result so if you want to actually result in some Deferred object in your callback you have to wrap it to circumvent the flattening.