mirror of
https://github.com/NixOS/nix
synced 2025-06-24 22:11:15 +02:00
Merge pull request #13231 from gwennlbh/docs-attrset-functor
docs: clarify attrset __functor
This commit is contained in:
commit
fad975b58f
1 changed files with 2 additions and 2 deletions
|
@ -225,8 +225,8 @@ passed in first , e.g.,
|
|||
|
||||
```nix
|
||||
let add = { __functor = self: x: x + self.x; };
|
||||
inc = add // { x = 1; };
|
||||
in inc 1
|
||||
inc = add // { x = 1; }; # inc is { x = 1; __functor = (...) }
|
||||
in inc 1 # equivalent of `add.__functor add 1` i.e. `1 + self.x`
|
||||
```
|
||||
|
||||
evaluates to `2`. This can be used to attach metadata to a function
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue