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

Do-Notation: Add support for explicit type annotations. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

soulsource
Copy link
Contributor

This is an attempt to support explicit type annotations in do-notation.

I am not happy with the syntax, as it requires extra parentheses, but I don't know how to convince Rust's macro matcher to accept a closure-parameter-like syntax otherwise...

The simple idea $binding:pat_param $(: $exp_ty:ty) <= .... does not work, as a pat_param fragment must not be followed by a colon (though the language's own closure parameter syntax does that), and a ty fragment must not be followed by <=....

However, while writing the test for this I noticed that my previous pull request for pattern matching also requires extra parentheses for patterns that aren't tuples - due to the reliance on token-tree fragments.

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.

1 participant