genAttrs'
lib.genAttrs'
Docs pulled from | This Revision | 9 minutes ago
Like genAttrs, but allows the name of each attribute to be specified in addition to the value.
The applied function should return both the new name and value as a nameValuePair.
In case of attribute name collision the first entry determines the value, all subsequent conflicting entries for the same name are silently ignored.
Inputs
xs-
A list of strings
sused as generator. f-
A function, given a string
sfrom the listxs, returns a newnameValuePair.
Type
genAttrs' :: [ Any ] -> (Any -> { name :: String; value :: Any; }) -> AttrSet
Examples
lib.attrsets.genAttrs' usage example
genAttrs' [ "foo" "bar" ] (s: nameValuePair ("x_" + s) ("y_" + s))
=> { x_foo = "y_foo"; x_bar = "y_bar"; }
Noogle detected
Implementation
The following is the current implementation of this function.
genAttrs' = xs: f: listToAttrs (map f xs);