higher icon indicating copy to clipboard operation
higher copied to clipboard

Do-Notation: Add support for explicit type annotations.

Open soulsource opened this issue 1 year ago • 0 comments

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.

soulsource avatar Oct 03 '24 17:10 soulsource