-
-
Save dwickstrom/bcd6b56538b93d9ba7cee7fa0aa84c9c to your computer and use it in GitHub Desktop.
Fantasy Land Promise
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Promise.of = Promise.resolve | |
Promise.prototype.chain = Promise.prototype.then | |
Promise.prototype.map = Promise.prototype.then | |
Promise.prototype.ap = function (other) { | |
this.chain(f => other.map(x => f(x))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment