Open jiribenes opened 4 days ago
I'm also not 100% sure that we want this feature, but it's very helpful in the zip
example in the PR text of #705.
Here's the code responsible for parsing with val ...
:
https://github.com/effekt-lang/effekt/blob/adf76cfd9346072e908e1c49217c4fb32cf57bbe/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala#L198-L204
where as here's the code responsible for parsing val (a, b) = ...
:
https://github.com/effekt-lang/effekt/blob/adf76cfd9346072e908e1c49217c4fb32cf57bbe/effekt/shared/src/main/scala/effekt/RecursiveDescent.scala#L398-L403
Problem statement
There's no way to unpack more complex types the using
with val _ = ...
syntax sugar.Motivation
When working with
stream
, I tried to do something like:in order to unpack the tuple. However, that's wrong since this sugar would imply that foreach takes two arguments as it desugars to something like:
But the correct diet, sugar-free version is the following:
Possible and impossible workarounds
I tried to remedy this by using
Tuple2(i, x)
explicitly, but that reports a parse error:Similarly if I try to use a custom type:
What does work is the following: