> In some sense, jQuery is an example of a monadic library, wherein the unit function is $, which lifts its argument into the jQuery monad, and bind is represented by the chain of method calls applied to that lifted value, each of which returns a different value, still wrapped in the jQuery monad.
Aha. Thank you. Ever since I first learned about monads in Haskell (which is not so long ago), I kept noticing examples of such patterns in some libraries and was wondering whether it's only me who thinks there is a similarity.
I've found it easiest to understand monads as "the theoretical basis behind what a lot of languages think of as features". The purpose of understanding monads feels to me as an exercise in returning to first principles.
Naturally, this has the usual consequence of first principles: a lot of things that seem obvious are no longer Just There for you to Take For Granted.
That said, I'm not really prepared to say I understand monads. :P
Aha. Thank you. Ever since I first learned about monads in Haskell (which is not so long ago), I kept noticing examples of such patterns in some libraries and was wondering whether it's only me who thinks there is a similarity.