summary refs log tree commit diff
path: root/lib/options.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-23 17:19:21 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-23 18:31:54 +0200
commit637e35deb99c5efbb8bd760a3ad08d3899534ead (patch)
treeea625d5e0795b8a5ea7426745c32b363299a2378 /lib/options.nix
parentf92619f6b88d10815c56b97238ed7e1f4220c1f9 (diff)
downloadnixpkgs-637e35deb99c5efbb8bd760a3ad08d3899534ead.tar
nixpkgs-637e35deb99c5efbb8bd760a3ad08d3899534ead.tar.gz
nixpkgs-637e35deb99c5efbb8bd760a3ad08d3899534ead.tar.bz2
nixpkgs-637e35deb99c5efbb8bd760a3ad08d3899534ead.tar.lz
nixpkgs-637e35deb99c5efbb8bd760a3ad08d3899534ead.tar.xz
nixpkgs-637e35deb99c5efbb8bd760a3ad08d3899534ead.tar.zst
nixpkgs-637e35deb99c5efbb8bd760a3ad08d3899534ead.zip
Use foldl' instead of fold in some places
Diffstat (limited to 'lib/options.nix')
-rw-r--r--lib/options.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/options.nix b/lib/options.nix
index bb72ad6d125..6e8e9ce0006 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -53,8 +53,8 @@ rec {
     if length list == 1 then head list
     else if all isFunction list then x: mergeDefaultOption loc (map (f: f x) list)
     else if all isList list then concatLists list
-    else if all isAttrs list then fold lib.mergeAttrs {} list
-    else if all isBool list then fold lib.or false list
+    else if all isAttrs list then foldl' lib.mergeAttrs {} list
+    else if all isBool list then foldl' lib.or false list
     else if all isString list then lib.concatStrings list
     else if all isInt list && all (x: x == head list) list then head list
     else throw "Cannot merge definitions of `${showOption loc}' given in ${showFiles (getFiles defs)}.";
@@ -68,7 +68,7 @@ rec {
   /* "Merge" option definitions by checking that they all have the same value. */
   mergeEqualOption = loc: defs:
     if defs == [] then abort "This case should never happen."
-    else fold (def: val:
+    else foldl' (val: def:
       if def.value != val then
         throw "The option `${showOption loc}' has conflicting definitions, in ${showFiles (getFiles defs)}."
       else