git.iko.soy/typeable/nixpkgs
on master help sign in
debug.nix: deprecate strict

Replace the implementation by seq and add a deprecation warning. The semantics seems a little bit off, but the function should only be used for debugging.

commit93bbe13f98c1759330a6a37728607f636734b930 authorProfpatsch <mail@profpatsch.de> dateSun 26 Jun 2016, 01:23 (10 years ago) parent6889f53
1 file changed+3−21
lib/debug.nix+3−21
lib/debug.nix+3−21
@@ -73,27 +73,9 @@ rec {
7373 # usage: { testX = allTrue [ true ]; }
7474 testAllTrue = expr : { inherit expr; expected = map (x: true) expr; };
7575
76− # evaluate everything once so that errors will occur earlier
77− # hacky: traverse attrs by adding a dummy
78− # ignores functions (should this behavior change?) See strictf
79− #
80− # Note: This should be a primop! Something like seq of haskell would be nice to
81− # have as well. It's used fore debugging only anyway
82− strict = x :
83− let
84− traverse = x :
85− if isString x then true
86− else if isAttrs x then
87− if x ? outPath then true
88− else all id (mapAttrsFlatten (n: traverse) x)
89− else if isList x then
90− all id (map traverse x)
91− else if isBool x then true
92− else if isFunction x then true
93− else if isInt x then true
94− else if x == null then true
95− else true; # a (store) path?
96− in if traverse x then x else throw "else never reached";
76+ strict = v:
77+ trace "Warning: strict is deprecated and will be removed in the next release"
78+ (builtins.seq v v);
9779
9880 # example: (traceCallXml "myfun" id 3) will output something like
9981 # calling myfun arg 1: 3 result: 3