1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-10-18 00:16:11 -04:00

doc: note that @-pattern is accessible in default values

This commit is contained in:
Valentin Gagarin 2024-10-10 22:40:37 +02:00
parent 4202d4fc81
commit a780ce4f58

View file

@ -503,6 +503,23 @@ three kinds of patterns:
> [ 23 {} ]
> ```
The complete function argument denoted as an `@`-pattern can be accessed inside default values.
> **Example**
>
> ```nix
> let
> f = args@{ x ? args.a, ... }: x;
> in
> f { a = 1; }
> ```
>
> evaluates to
>
> ```nix
> 1
> ```
Note that functions do not have names. If you want to give them a name,
you can bind them to an attribute, e.g.,