Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add replace operator <^ #92

Merged
merged 1 commit into from
May 17, 2015
Merged

Add replace operator <^ #92

merged 1 commit into from
May 17, 2015

Conversation

sharplet
Copy link
Collaborator

A combination of #91 and this article gave me the inspiration for this.

Should be a useful operator to have around when writing parsers in an applicative style.

@@ -47,5 +52,12 @@ infix operator <^> {
precedence 130
}

/// Replace operator.
infix operator <^ {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could also be useful to add ^> I suppose, but because Haskell defines only <$ I haven't added it here (for now).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, you’d still have the value on the left and the parser on the right, I think, and value ^> parser is really just parser.

@robrix
Copy link
Owner

robrix commented May 17, 2015

✨ Nice!

This deserves a write-up in the README, but we can tackle that in #91 to avoid conflicts 👍

robrix added a commit that referenced this pull request May 17, 2015
Add replace operator `<^`
@robrix robrix merged commit 44a7a12 into master May 17, 2015
@robrix robrix deleted the replace branch May 17, 2015 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants