From 637e35deb99c5efbb8bd760a3ad08d3899534ead Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 23 Jul 2015 17:19:21 +0200 Subject: Use foldl' instead of fold in some places --- lib/options.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/options.nix') 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 -- cgit 1.4.1