higher
higher copied to clipboard
Do-Notation: Add support for explicit type annotations.
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.