1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

docs: clarify attrset __functor

This commit is contained in:
Gwenn Le Bihan 2025-05-19 16:58:16 +02:00 committed by GitHub
parent 8c10104e9e
commit 5c512a4ee1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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