diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-10-28 07:51:46 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2013-10-28 22:45:55 +0100 |
commit | b479dac8dfe3baefe5a080a2f17b41fd1ef37025 (patch) | |
tree | c5620c1a1f0a3321a42919b02e0281348a9ea497 /lib/attrsets.nix | |
parent | 97696712600302690f55c0efe8d20ef101077749 (diff) | |
download | nixpkgs-b479dac8dfe3baefe5a080a2f17b41fd1ef37025.tar nixpkgs-b479dac8dfe3baefe5a080a2f17b41fd1ef37025.tar.gz nixpkgs-b479dac8dfe3baefe5a080a2f17b41fd1ef37025.tar.bz2 nixpkgs-b479dac8dfe3baefe5a080a2f17b41fd1ef37025.tar.lz nixpkgs-b479dac8dfe3baefe5a080a2f17b41fd1ef37025.tar.xz nixpkgs-b479dac8dfe3baefe5a080a2f17b41fd1ef37025.tar.zst nixpkgs-b479dac8dfe3baefe5a080a2f17b41fd1ef37025.zip |
Inline some functions on the critical path
Diffstat (limited to 'lib/attrsets.nix')
-rw-r--r-- | lib/attrsets.nix | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 40bc1667b85..7c93d8698de 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -29,9 +29,8 @@ rec { ["x" "y"] applied with some value v returns `x.y = v;' */ setAttrByPath = attrPath: value: if attrPath == [] then value - else listToAttrs [( - nameValuePair (head attrPath) (setAttrByPath (tail attrPath) value) - )]; + else listToAttrs + [ { name = head attrPath; value = setAttrByPath (tail attrPath) value; } ]; getAttrFromPath = attrPath: set: @@ -133,7 +132,7 @@ rec { => { x = "x-foo"; y = "y-bar"; } */ mapAttrs = f: set: - listToAttrs (map (attr: nameValuePair attr (f attr (getAttr attr set))) (attrNames set)); + listToAttrs (map (attr: { name = attr; value = f attr (getAttr attr set); }) (attrNames set)); /* Like `mapAttrs', but allows the name of each attribute to be |