diff options
Diffstat (limited to 'nixpkgs/doc/functions')
-rw-r--r-- | nixpkgs/doc/functions/library/asserts.xml | 2 | ||||
-rw-r--r-- | nixpkgs/doc/functions/library/attrsets.xml | 39 |
2 files changed, 40 insertions, 1 deletions
diff --git a/nixpkgs/doc/functions/library/asserts.xml b/nixpkgs/doc/functions/library/asserts.xml index 10891039e869..7c94222ef139 100644 --- a/nixpkgs/doc/functions/library/asserts.xml +++ b/nixpkgs/doc/functions/library/asserts.xml @@ -103,7 +103,7 @@ stderr> assert failed <title>Ensuring a user provided a possible value</title> <programlisting><![CDATA[ let sslLibrary = "bearssl"; -in lib.asserts.assertOneOf "sslLibrary" sslLibrary [ "openssl" "bearssl" ]; +in lib.asserts.assertOneOf "sslLibrary" sslLibrary [ "openssl" "libressl" ]; => false stderr> trace: sslLibrary must be one of "openssl", "libressl", but is: "bearssl" ]]></programlisting> diff --git a/nixpkgs/doc/functions/library/attrsets.xml b/nixpkgs/doc/functions/library/attrsets.xml index 3c5823c25891..7ef0d16624c8 100644 --- a/nixpkgs/doc/functions/library/attrsets.xml +++ b/nixpkgs/doc/functions/library/attrsets.xml @@ -1711,4 +1711,43 @@ recursiveUpdate </example> </section> + <section xml:id="function-library-lib.attrsets.cartesianProductOfSets"> + <title><function>lib.attrsets.cartesianProductOfSets</function></title> + + <subtitle><literal>cartesianProductOfSets :: AttrSet -> [ AttrSet ]</literal> + </subtitle> + + <xi:include href="./locations.xml" xpointer="lib.attrsets.cartesianProductOfSets" /> + + <para> + Return the cartesian product of attribute set value combinations. + </para> + + <variablelist> + <varlistentry> + <term> + <varname>set</varname> + </term> + <listitem> + <para> + An attribute set with attributes that carry lists of values. + </para> + </listitem> + </varlistentry> + </variablelist> + + <example xml:id="function-library-lib.attrsets.cartesianProductOfSets-example"> + <title>Creating the cartesian product of a list of attribute values</title> +<programlisting><![CDATA[ +cartesianProductOfSets { a = [ 1 2 ]; b = [ 10 20 ]; } +=> [ + { a = 1; b = 10; } + { a = 1; b = 20; } + { a = 2; b = 10; } + { a = 2; b = 20; } + ] +]]></programlisting> + </example> + </section> + </section> |