query
On this page

concatMapAttrs

lib.attrsets.concatMapAttrs

Docs pulled from | This Revision | about 1 hour ago


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 -> a -> 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

Aliases

Implementation

The following is the current implementation of this function.

concatMapAttrs = f: v:
    foldl' mergeAttrs { }
      (attrValues
        (mapAttrs f v)
      );