concatMapAttrs
lib.attrsets.concatMapAttrs
Docs pulled from | This Revision | 18 days ago
Nixpkgs manual
Map each attribute in the given set and merge them into a new attribute set.
Inputs
f-
1. Function argument
v-
2. Function argument
Type
concatMapAttrs :: (String -> Any -> AttrSet) -> AttrSet -> AttrSet
Examples
lib.attrsets.concatMapAttrs usage example
concatMapAttrs
(name: value: {
${name} = value;
${name + value} = value;
})
{ x = "a"; y = "b"; }
=> { x = "a"; xa = "a"; y = "b"; yb = "b"; }
Noogle detected
Implementation
The following is the current implementation of this function.
concatMapAttrs =
f: v:
listToAttrs (
concatLists (reverseList (mapAttrsToList (name: value: attrsToList (f name value)) v))
);