mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
lib.attrsets: Remove unneeded polyfills
Nix 2.3 (the minimum version needed to evaluate Nixpkgs) supports these, so no need to keep them around.
This commit is contained in:
parent
27488b861c
commit
31d23ba418
@ -2,10 +2,10 @@
|
|||||||
{ lib }:
|
{ lib }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (builtins) head tail length;
|
inherit (builtins) head length;
|
||||||
inherit (lib.trivial) id mergeAttrs warn;
|
inherit (lib.trivial) mergeAttrs warn;
|
||||||
inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName;
|
inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName;
|
||||||
inherit (lib.lists) foldr foldl' concatMap concatLists elemAt all partition groupBy take foldl;
|
inherit (lib.lists) foldr foldl' concatMap elemAt all partition groupBy take foldl;
|
||||||
in
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
@ -369,7 +369,7 @@ rec {
|
|||||||
Type:
|
Type:
|
||||||
attrValues :: AttrSet -> [Any]
|
attrValues :: AttrSet -> [Any]
|
||||||
*/
|
*/
|
||||||
attrValues = builtins.attrValues or (attrs: attrVals (attrNames attrs) attrs);
|
attrValues = builtins.attrValues;
|
||||||
|
|
||||||
|
|
||||||
/* Given a set of attribute names, return the set of the corresponding
|
/* Given a set of attribute names, return the set of the corresponding
|
||||||
@ -398,8 +398,7 @@ rec {
|
|||||||
Type:
|
Type:
|
||||||
catAttrs :: String -> [AttrSet] -> [Any]
|
catAttrs :: String -> [AttrSet] -> [Any]
|
||||||
*/
|
*/
|
||||||
catAttrs = builtins.catAttrs or
|
catAttrs = builtins.catAttrs;
|
||||||
(attr: l: concatLists (map (s: if s ? ${attr} then [s.${attr}] else []) l));
|
|
||||||
|
|
||||||
|
|
||||||
/* Filter an attribute set by removing all attributes for which the
|
/* Filter an attribute set by removing all attributes for which the
|
||||||
@ -608,9 +607,7 @@ rec {
|
|||||||
Type:
|
Type:
|
||||||
mapAttrs :: (String -> Any -> Any) -> AttrSet -> AttrSet
|
mapAttrs :: (String -> Any -> Any) -> AttrSet -> AttrSet
|
||||||
*/
|
*/
|
||||||
mapAttrs = builtins.mapAttrs or
|
mapAttrs = builtins.mapAttrs;
|
||||||
(f: set:
|
|
||||||
listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)));
|
|
||||||
|
|
||||||
|
|
||||||
/* Like `mapAttrs`, but allows the name of each attribute to be
|
/* Like `mapAttrs`, but allows the name of each attribute to be
|
||||||
|
Loading…
Reference in New Issue
Block a user