Skip to content

Instantly share code, notes, and snippets.

@ccorcos
Created March 2, 2017 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccorcos/2d1eeaf8ae31f4d6af7296710f65347e to your computer and use it in GitHub Desktop.
Save ccorcos/2d1eeaf8ae31f4d6af7296710f65347e to your computer and use it in GitHub Desktop.
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