Skip to content

Instantly share code, notes, and snippets.

@ccorcos
Created March 2, 2017 04:42
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/112496bcb6e1cdd53a2f90c56d623335 to your computer and use it in GitHub Desktop.
Save ccorcos/112496bcb6e1cdd53a2f90c56d623335 to your computer and use it in GitHub Desktop.
const not = parser =>
new Parser(stream =>
parser.run(stream)
.fold(
(value, s) => new Failure('not failed', stream),
(value, s) =>
stream.length > 0
? new Success(stream.head(), stream.move(1))
: new Failure('unexpected end', stream)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment