From ef0e4d56f57b936aa2f15ecea730bdeb53837c0f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 20 Mar 2015 15:53:25 +0100 Subject: Use builtin seq/deepSeq --- lib/trivial.nix | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'lib/trivial.nix') diff --git a/lib/trivial.nix b/lib/trivial.nix index ed59eff48473..8addde1b86cd 100644 --- a/lib/trivial.nix +++ b/lib/trivial.nix @@ -1,8 +1,3 @@ -with { - inherit (import ./lists.nix) deepSeqList; - inherit (import ./attrsets.nix) deepSeqAttrs; -}; - rec { # Identity function. @@ -23,23 +18,11 @@ rec { # Flip the order of the arguments of a binary function. flip = f: a: b: f b a; - # `seq x y' evaluates x, then returns y. That is, it forces strict - # evaluation of its first argument. - seq = x: y: if x == null then y else y; - - # Like `seq', but recurses into lists and attribute sets to force evaluation - # of all list elements/attributes. - deepSeq = x: y: - if builtins.isList x - then deepSeqList x y - else if builtins.isAttrs x - then deepSeqAttrs x y - else seq x y; - # Pull in some builtins not included elsewhere. inherit (builtins) pathExists readFile isBool isFunction - isInt add sub lessThan; + isInt add sub lessThan + seq deepSeq; # Return the Nixpkgs version number. nixpkgsVersion = -- cgit v1.2.3