diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-03-20 15:53:25 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-03-20 19:29:21 +0100 |
commit | ef0e4d56f57b936aa2f15ecea730bdeb53837c0f (patch) | |
tree | 2383cd76b796a098573214cdca0db350ad52a9e8 /lib/trivial.nix | |
parent | dda16e0c06d6f92cd720579c214221fbf5e93306 (diff) |
Use builtin seq/deepSeq
Diffstat (limited to 'lib/trivial.nix')
-rw-r--r-- | lib/trivial.nix | 21 |
1 files changed, 2 insertions, 19 deletions
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 = |