1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 18:01:16 +02:00

Merge pull request #13231 from gwennlbh/docs-attrset-functor

docs: clarify attrset __functor
This commit is contained in:
Jörg Thalheim 2025-05-20 09:03:13 +02:00 committed by GitHub
commit fad975b58f
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