about summary refs log tree commit diff
path: root/lib/attrsets.nix
diff options
context:
space:
mode:
authorGabriel Volpe <volpegabriel@gmail.com>2024-04-15 19:03:54 +0200
committerGabriel Volpe <volpegabriel@gmail.com>2024-04-15 19:03:54 +0200
commit228621e42dc43f936b66e0ed042c90c511aa0535 (patch)
tree199e5f2331ad0a14c609e7eb6787f1b33d8e43aa /lib/attrsets.nix
parent7e358fc824230a4649981c94ab86e07abd2a32b9 (diff)
lib/attrsets: rename cartesianProductOfSets to cartesianProduct
Diffstat (limited to 'lib/attrsets.nix')
-rw-r--r--lib/attrsets.nix14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index 49d311ed37b39..5c4f735b63da2 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -5,7 +5,7 @@
 
 let
   inherit (builtins) head length;
-  inherit (lib.trivial) mergeAttrs warn;
+  inherit (lib.trivial) isInOldestRelease mergeAttrs warn warnIf;
   inherit (lib.strings) concatStringsSep concatMapStringsSep escapeNixIdentifier sanitizeDerivationName;
   inherit (lib.lists) foldr foldl' concatMap elemAt all partition groupBy take foldl;
 in
@@ -885,15 +885,15 @@ rec {
     # Type
 
     ```
-    cartesianProductOfSets :: AttrSet -> [AttrSet]
+    cartesianProduct :: AttrSet -> [AttrSet]
     ```
 
     # Examples
     :::{.example}
-    ## `lib.attrsets.cartesianProductOfSets` usage example
+    ## `lib.attrsets.cartesianProduct` usage example
 
     ```nix
-    cartesianProductOfSets { a = [ 1 2 ]; b = [ 10 20 ]; }
+    cartesianProduct { a = [ 1 2 ]; b = [ 10 20 ]; }
     => [
          { a = 1; b = 10; }
          { a = 1; b = 20; }
@@ -904,7 +904,7 @@ rec {
 
     :::
   */
-  cartesianProductOfSets =
+  cartesianProduct =
     attrsOfLists:
     foldl' (listOfAttrs: attrName:
       concatMap (attrs:
@@ -1999,4 +1999,8 @@ rec {
   # DEPRECATED
   zip = warn
     "lib.zip is a deprecated alias of lib.zipAttrsWith." zipAttrsWith;
+
+  # DEPRECATED
+  cartesianProductOfSets = warnIf (isInOldestRelease 2405)
+    "lib.cartesianProductOfSets is a deprecated alias of lib.cartesianProduct." cartesianProduct;
 }