···
traceXMLVal = x: trace (builtins.toXML x) x;
traceXMLValMarked = str: x: trace (str + builtins.toXML x) x;
22
+
# strict trace functions (traced structure is fully evaluated and printed)
23
+
traceSeq = x: y: trace (builtins.deepSeq x x) y;
24
+
traceValSeq = v: traceVal (builtins.deepSeq v v);
# this can help debug your code as well - designed to not produce thousands of lines
traceShowVal = x : trace (showVal x) x;
traceShowValMarked = str: x: trace (str + showVal x) x;
···
# usage: { testX = allTrue [ true ]; }
testAllTrue = expr : { inherit expr; expected = map (x: true) expr; };
72
-
# evaluate everything once so that errors will occur earlier
73
-
# hacky: traverse attrs by adding a dummy
74
-
# ignores functions (should this behavior change?) See strictf
76
-
# Note: This should be a primop! Something like seq of haskell would be nice to
77
-
# have as well. It's used fore debugging only anyway
81
-
if isString x then true
82
-
else if isAttrs x then
83
-
if x ? outPath then true
84
-
else all id (mapAttrsFlatten (n: traverse) x)
85
-
else if isList x then
86
-
all id (map traverse x)
87
-
else if isBool x then true
88
-
else if isFunction x then true
89
-
else if isInt x then true
90
-
else if x == null then true
91
-
else true; # a (store) path?
92
-
in if traverse x then x else throw "else never reached";
77
+
trace "Warning: strict is deprecated and will be removed in the next release"
# example: (traceCallXml "myfun" id 3) will output something like
# calling myfun arg 1: 3 result: 3