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:
parent
4202d4fc81
commit
a780ce4f58
|
@ -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.,
|
||||
|
||||
|
|
Loading…
Reference in a new issue