monads javascript code example
Example: what is monad in javascript
function Identity(value) {
this.value = value;
}
Identity.prototype.bind = function(transform) {
return transform(this.value);
};
Identity.prototype.toString = function() {
return 'Identity(' + this.value + ')';
};