Use builtin seq/deepSeq

This commit is contained in:
Eelco Dolstra 2015-03-20 15:53:25 +01:00
parent dda16e0c06
commit ef0e4d56f5

View File

@ -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 =