Created
July 17, 2015 02:45
-
-
Save yelouafi/ae5e18720dce28f4a0c6 to your computer and use it in GitHub Desktop.
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
// mergeMap : (Stream a, a -> Stream b) => Stream b | |
Stream.prototype.mergeMap = function(f) { | |
return this.map(f).mergeAll(); | |
} | |
// example : log messages from a chat room | |
// login user returns a stream of messages from a logged user | |
loginUser : (name, password) -> Stream String | |
button.on('click').mergeMap( _ => loginUser(name, password) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment