diff options
author | Graham Christensen <graham@grahamc.com> | 2018-10-12 16:31:23 -0400 |
---|---|---|
committer | Graham Christensen <graham@grahamc.com> | 2018-10-12 16:54:34 -0400 |
commit | 77140a9075ea651c060fcb91a7a5da832e3a1e68 (patch) | |
tree | 74c05b77dd13cd4b2e6c571c78a372d62c18da3b /doc/functions/library | |
parent | 655a5fa8bf47e104a50a2e627e1cf234fff1402e (diff) | |
download | nixlib-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar nixlib-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.gz nixlib-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.bz2 nixlib-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.lz nixlib-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.xz nixlib-77140a9075ea651c060fcb91a7a5da832e3a1e68.tar.zst nixlib-77140a9075ea651c060fcb91a7a5da832e3a1e68.zip |
nixpkgs docs: document zipAttrs
Diffstat (limited to 'doc/functions/library')
-rw-r--r-- | doc/functions/library/attrsets.xml | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/doc/functions/library/attrsets.xml b/doc/functions/library/attrsets.xml index da73e02e0561..a719b7958458 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> |