zipWithNames
lib.zipWithNames
Docs pulled from | This Revision | about 1 hour ago
Merge sets of attributes and use the function f
to merge attributes
values.
Inputs
names
-
List of attribute names to zip.
f
-
A function, accepts an attribute name, all the values, and returns a combined value.
sets
-
List of values from the list of attribute sets.
Type
zipAttrsWithNames :: [ String ] -> (String -> [ Any ] -> Any) -> [ AttrSet ] -> AttrSet
Examples
lib.attrsets.zipAttrsWithNames
usage example
zipAttrsWithNames ["a"] (name: vs: vs) [{a = "x";} {a = "y"; b = "z";}]
=> { a = ["x" "y"]; }
Noogle detected
Implementation
The following is the current implementation of this function.
zipAttrsWithNames =
names:
f:
sets:
listToAttrs (map (name: {
inherit name;
value = f name (catAttrs name sets);
}) names);