about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohannes Kirschbauer <hsjobeki@gmail.com>2024-03-16 22:58:14 +0100
committerJohannes Kirschbauer <hsjobeki@gmail.com>2024-03-16 22:58:14 +0100
commitc8885b86b269742bb6618b8d841cffb4e7725504 (patch)
tree4d252b32729ea67e8a50d0806d798116caa67c5a
parent9beef9f1ba3c97c939c38af5c0ea6752fff11bb5 (diff)
lib.foldl': document eta expansion
-rw-r--r--lib/lists.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/lists.nix b/lib/lists.nix
index d8cf8732d2392..c162f921280d2 100644
--- a/lib/lists.nix
+++ b/lib/lists.nix
@@ -228,7 +228,15 @@ rec {
 
     `acc`
 
-    : The initial accumulator value
+    : The initial accumulator value.
+
+      The accumulator value is evaluated in any case before the first iteration starts.
+
+      To avoid evaluation even before the `list` argument is given an eta expansion can be used:
+
+      ```nix
+      list: lib.foldl' op acc list
+      ```
 
     `list`