roc: Destructuring tag with `=` generates parsing error
This currently produces an ARGUMENTS BEFORE EQUALS parsing error, but it should be parsed as a valid def (when used either as a top-level declaration or in an expression):
Email str = Email "blah@example.com"
It should put str in scope and set it equal to "blah@example.com" - just like if I did this:
{ str } = { str: "blah@example.com" }
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (15 by maintainers)
those are the three places a pattern can syntactically occur, yes
Nope! In this case generalization is not a concern, since the โemailโ parameter in the function definition is not under a let binding before it accessed in the body. Changing it to be a type error is done the same way as we did in #2299
See #2305, which contains a fix for the parsing error and changes the above to a type error ๐
I see this as a separate question from how
=should affect type inference - for example, if I have a function that accepts a[ True, False, Blah ], should I be able to give aBoolto it? I can see arguments for and against that design question, but I think itโs a separate issue! ๐