Is your feature request related to a problem? Please describe.
I am currently working on the nix -> nickel transpiler PR over in this branch https://github.com/ajbt200128/nickel/tree/nix/nickel. One issue is that nix supports recursive pattern matching in record patterns:
let f = { x ? y, y ? x}: x + y; in f { x = 1; }
> 2
But nickel does not
let f = fun { x ? y, y ? x} => x + y in f { x = 1 }
┌─ <repl-input-0>:1:26
│
1 │ let f = fun { x ? y, y ? x} => x + y in f { x = 1 }
│ ^ this identifier is unbound
Describe the solution you'd like
It would be great if we emulated this behavior in nickel, as it make pattern matching more powerful, and would be more consistent since records can already be recursively defined in a normal definition. Additionally it will make the nix transpiler easier to write
Describe alternatives you've considered
We could desugar this in only the transpiler, but that will require repeating a bunch of the pattern matching code that already exists in nickel
Is your feature request related to a problem? Please describe. I am currently working on the nix -> nickel transpiler PR over in this branch https://github.com/ajbt200128/nickel/tree/nix/nickel. One issue is that nix supports recursive pattern matching in record patterns:
But nickel does not
Describe the solution you'd like It would be great if we emulated this behavior in nickel, as it make pattern matching more powerful, and would be more consistent since records can already be recursively defined in a normal definition. Additionally it will make the nix transpiler easier to write
Describe alternatives you've considered We could desugar this in only the transpiler, but that will require repeating a bunch of the pattern matching code that already exists in nickel