Most APIs do not satisify the monad laws. jQuery
is a large API
, so statistically, it is unlikely to be “accidentally” monadic. As a result I am pretty skeptical that the jQuery
API as a whole could satisfy the monad laws (i.e. that “jQuery is a monad”).
This doesn’t mean that a given (very restricted) subset might not satisfy them, but the API as a whole is likely to contain “unsafe” operations that would violate the laws when used, breaking the abstraction.
Since no one seems to have offered evidence that the API in whole or part satisifies the laws, I suggest we should assume it does not, until evidence is provided.
It must be shown:
- what jQuery operation corresponds to
return
(lifting a value into the jQuery monad)? - what jQuery operation corresponds to
bind
, for gluing computations together? - how do the left-, right- and associativity laws hold over those operations?
And then, what law violations are possible given the rest of the jQuery API? Can I, for example, break the bind
by calling one of the other API functions?
References:
- jQuery is not a monad
- jQuery still is not a monad