query
On this page

genAttrs

lib.attrsets.genAttrs

Docs pulled from | This Revision | about 12 hours ago


Generate an attribute set by mapping a function over a list of attribute names.

Inputs

names

Names of values in the resulting attribute set.

f

A function, given the name of the attribute, returns the attribute's value.

Type

genAttrs :: [ String ] -> (String -> Any) -> AttrSet

Examples

lib.attrsets.genAttrs usage example

genAttrs [ "foo" "bar" ] (name: "x_" + name)
=> { foo = "x_foo"; bar = "x_bar"; }

Noogle also knows

Aliases