-
-
Save dminuoso/cc021f7ba9ea9748333ab47e2d6203cc 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
# Non-deterministic choice between two parsers | |
# choice :: Parser a -> Parser a -> Parser a | |
choice = -> parser1, parser 2 { ... }.curry | |
# Enhance a parser to possibly fail | |
# maybe :: Parser a -> Parser (a + nil) | |
maybe = -> parser { ... } | |
# Sequence two parsers | |
# sequence :: Parser a -> Parser b -> Parser b | |
sequence = -> parser { ... } | |
# Runs one parser, feeds the result into the function, and then runs the resulting parser. | |
# bind :: Parser a -> (a -> Parser b) -> Parser b | |
bind = -> parser, kf { ... }.curry | |
# Repeats a parser n times and returns all results packed into an array. | |
# repeat :: Int -> Parser a -> Parser [a] | |
repeat = -> n, parser { ... }.curry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment