lib: attrs: add 'recursiveMerge'

This commit is contained in:
Bruno BELANYI 2021-09-23 21:55:17 +02:00
parent bd1a2000fe
commit 3fa14ebe71

View file

@ -1,6 +1,13 @@
{ lib, ... }: { lib, ... }:
let let
inherit (lib) filterAttrs listToAttrs mapAttrs' nameValuePair; inherit (lib)
filterAttrs
foldl
listToAttrs
mapAttrs'
nameValuePair
recursiveUpdate
;
in in
{ {
# Filter a generated set of attrs using a predicate function. # Filter a generated set of attrs using a predicate function.
@ -19,6 +26,13 @@ in
# attrs # attrs
genAttrs' = values: f: listToAttrs (map f values); genAttrs' = values: f: listToAttrs (map f values);
# Merge a list of attrs recursively, later values override previous ones.
#
# recursiveMerge ::
# [ attrs ]
# attrs
recursiveMerge = foldl recursiveUpdate { };
# Rename each of the attributes in an attribute set using the mapping function # Rename each of the attributes in an attribute set using the mapping function
# #
# renameAttrs :: # renameAttrs ::