Created
July 17, 2015 02:11
-
-
Save yelouafi/720db06a07319c2be36b to your computer and use it in GitHub Desktop.
This file contains 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
// any : ( Stream a, a -> aBoolean ) -> Promise Boolean | |
Stream.prototype.any = function(pred) { | |
return this.isEmpty ? Promise.resolve(false) | |
: this.isAbort ? Promise.reject(this.err) | |
: this.isCons ? | |
(pred(this.head) ? Promise.resolve(true) : this.tail.any(pred) ) | |
: /* isFuture */ | |
this.promise.then( s => s.any(pred) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment