Created
March 2, 2017 04:40
-
-
Save ccorcos/2d1eeaf8ae31f4d6af7296710f65347e 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
const either = list => | |
new Parser(stream => { | |
for (let i = 0; i < list.length; i++) { | |
const parser = list[i] | |
const result = parser.run(stream) | |
if (result instanceof Success) { | |
return result | |
} | |
} | |
return new Failure('either failed', stream) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment