summary refs log tree commit diff
path: root/doc/functions/library/attrsets.xml
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2018-10-12 16:31:23 -0400
committerGraham Christensen <graham@grahamc.com>2018-10-12 16:54:34 -0400
commit77140a9075ea651c060fcb91a7a5da832e3a1e68 (patch)
tree74c05b77dd13cd4b2e6c571c78a372d62c18da3b /doc/functions/library/attrsets.xml
parent655a5fa8bf47e104a50a2e627e1cf234fff1402e (diff)
downloadnixpkgs-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar
nixpkgs-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.gz
nixpkgs-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.bz2
nixpkgs-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.lz
nixpkgs-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.xz
nixpkgs-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.zst
nixpkgs-77140a9075ea651c060fcb91a7a5da832e3a1e68.zip
nixpkgs docs: document zipAttrs
Diffstat (limited to 'doc/functions/library/attrsets.xml')
-rw-r--r--doc/functions/library/attrsets.xml45
1 files changed, 44 insertions, 1 deletions
diff --git a/doc/functions/library/attrsets.xml b/doc/functions/library/attrsets.xml
index da73e02e056..a719b795845 100644
--- a/doc/functions/library/attrsets.xml
+++ b/doc/functions/library/attrsets.xml
@@ -1452,7 +1452,8 @@ lib.attrsets.zipAttrsWithNames
 
   <para>
    Merge sets of attributes and use the function <varname>f</varname> to merge
-   attribute values. Similar to <xref
+   attribute values. Similar to
+   <xref
    linkend="function-library-lib.attrsets.zipAttrsWithNames" /> where
    all key names are passed for <varname>names</varname>.
   </para>
@@ -1520,4 +1521,46 @@ lib.attrsets.zipAttrsWith
      ]]></programlisting>
   </example>
  </section>
+
+ <section xml:id="function-library-lib.attrsets.zipAttrs">
+  <title><function>lib.attrsets.zipAttrs</function></title>
+
+  <subtitle><literal>zipAttrsWith :: [ AttrSet ] -> AttrSet</literal>
+  </subtitle>
+
+  <xi:include href="./locations.xml" xpointer="lib.attrsets.zipAttrs" />
+
+  <para>
+   Merge sets of attributes and combine each attribute value in to a list.
+   Similar to <xref linkend="function-library-lib.attrsets.zipAttrsWith" />
+   where the merge function returns a list of all values.
+  </para>
+
+  <variablelist>
+   <varlistentry>
+    <term>
+     <varname>sets</varname>
+    </term>
+    <listitem>
+     <para>
+      A list of attribute sets to zip together.
+     </para>
+    </listitem>
+   </varlistentry>
+  </variablelist>
+
+  <example xml:id="function-library-lib.attrsets.zipAttrs-example">
+   <title>Combining a list of attribute sets</title>
+<programlisting><![CDATA[
+lib.attrsets.zipAttrs
+  [
+    { a = 1; b = 1; c = 1; }
+    { a = 10; }
+    { b = 100; }
+    { c = 1000; }
+  ]
+=> { a = [ 1 10 ]; b = [ 1 100 ]; c = [ 1 1000 ]; }
+     ]]></programlisting>
+  </example>
+ </section>
 </section>