diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-07-27 12:01:20 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-27 12:01:20 +0000 |
commit | 2692c2e4277b0b1b3b01299462f238efccba91e2 (patch) | |
tree | 9c186fa1b83585cd1f7f82351b8c8d061bfd6395 /lib | |
parent | 4fc4793298c10b1d648a0f269bc44394d5171c9e (diff) | |
parent | 2431a34ffe50eeb382ea4d7f8d3984e9029d6e04 (diff) | |
download | nixpkgs-2692c2e4277b0b1b3b01299462f238efccba91e2.tar nixpkgs-2692c2e4277b0b1b3b01299462f238efccba91e2.tar.gz nixpkgs-2692c2e4277b0b1b3b01299462f238efccba91e2.tar.bz2 nixpkgs-2692c2e4277b0b1b3b01299462f238efccba91e2.tar.lz nixpkgs-2692c2e4277b0b1b3b01299462f238efccba91e2.tar.xz nixpkgs-2692c2e4277b0b1b3b01299462f238efccba91e2.tar.zst nixpkgs-2692c2e4277b0b1b3b01299462f238efccba91e2.zip |
Merge master into staging-next
Diffstat (limited to 'lib')
-rw-r--r-- | lib/attrsets.nix | 8 | ||||
-rw-r--r-- | lib/deprecated.nix | 10 | ||||
-rw-r--r-- | lib/trivial.nix | 2 |
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/attrsets.nix b/lib/attrsets.nix index 5c787940cb0..0b61819f6b4 100644 --- a/lib/attrsets.nix +++ b/lib/attrsets.nix @@ -5,7 +5,7 @@ let inherit (builtins) head tail length; inherit (lib.trivial) and; inherit (lib.strings) concatStringsSep sanitizeDerivationName; - inherit (lib.lists) fold concatMap concatLists; + inherit (lib.lists) fold foldr concatMap concatLists; in rec { @@ -152,8 +152,8 @@ rec { => { a = [ 2 3 ]; } */ foldAttrs = op: nul: list_of_attrs: - fold (n: a: - fold (name: o: + foldr (n: a: + foldr (name: o: o // { ${name} = op n.${name} (a.${name} or nul); } ) a (attrNames n) ) {} list_of_attrs; @@ -455,7 +455,7 @@ rec { => true */ matchAttrs = pattern: attrs: assert isAttrs pattern; - fold and true (attrValues (zipAttrsWithNames (attrNames pattern) (n: values: + foldr and true (attrValues (zipAttrsWithNames (attrNames pattern) (n: values: let pat = head values; val = head (tail values); in if length values == 1 then false else if isAttrs pat then isAttrs val && matchAttrs pat val diff --git a/lib/deprecated.nix b/lib/deprecated.nix index be0ef904c66..ddce69f160c 100644 --- a/lib/deprecated.nix +++ b/lib/deprecated.nix @@ -77,11 +77,11 @@ rec { # Output : are reqs satisfied? It's asserted. checkReqs = attrSet: argList: condList: ( - fold lib.and true + foldr lib.and true (map (x: let name = (head x); in ((checkFlag attrSet name) -> - (fold lib.and true + (foldr lib.and true (map (y: let val=(getValue attrSet argList y); in (val!=null) && (val!=false)) (tail x))))) condList)); @@ -177,7 +177,7 @@ rec { # merge attributes with custom function handling the case that the attribute # exists in both sets mergeAttrsWithFunc = f: set1: set2: - fold (n: set: if set ? ${n} + foldr (n: set: if set ? ${n} then setAttr set n (f set.${n} set2.${n}) else set ) (set2 // set1) (attrNames set2); @@ -196,7 +196,7 @@ rec { mergeAttrsNoOverride = { mergeLists ? ["buildInputs" "propagatedBuildInputs"], overrideSnd ? [ "buildPhase" ] }: attrs1: attrs2: - fold (n: set: + foldr (n: set: setAttr set n ( if set ? ${n} then # merge if elem n mergeLists # attribute contains list, merge them by concatenating @@ -224,7 +224,7 @@ rec { mergeAttrBy2 = { mergeAttrBy = lib.mergeAttrs; } // (maybeAttr "mergeAttrBy" {} x) // (maybeAttr "mergeAttrBy" {} y); in - fold lib.mergeAttrs {} [ + foldr lib.mergeAttrs {} [ x y (mapAttrs ( a: v: # merge special names using given functions if x ? ${a} diff --git a/lib/trivial.nix b/lib/trivial.nix index e1581f1e91d..c8ef5599ccd 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -308,7 +308,7 @@ rec { info = msg: builtins.trace "INFO: ${msg}"; - showWarnings = warnings: res: lib.fold (w: x: warn w x) res warnings; + showWarnings = warnings: res: lib.foldr (w: x: warn w x) res warnings; ## Function annotations |