summary refs log tree commit diff
path: root/pkgs/lib/trivial.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/lib/trivial.nix')
-rw-r--r--pkgs/lib/trivial.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/lib/trivial.nix b/pkgs/lib/trivial.nix
index af47a8c8841..8af3474f2a6 100644
--- a/pkgs/lib/trivial.nix
+++ b/pkgs/lib/trivial.nix
@@ -1,3 +1,8 @@
+with {
+  inherit (import ./lists.nix) deepSeqList;
+  inherit (import ./attrsets.nix) deepSeqAttrs;
+};
+
 rec {
 
   # Identity function.
@@ -22,4 +27,12 @@ rec {
   # 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;
 }