* Improve showVal: handle integer and strings.
svn path=/nixpkgs/trunk/; revision=18346
This commit is contained in:
parent
47de42835a
commit
7482474aef
|
@ -1,6 +1,6 @@
|
||||||
let lib = import ./default.nix;
|
let lib = import ./default.nix;
|
||||||
|
|
||||||
inherit (builtins) trace attrNamesToStr isAttrs isFunction isList head substring attrNames;
|
inherit (builtins) trace attrNamesToStr isAttrs isFunction isList isInt isString head substring attrNames;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -37,7 +37,10 @@ rec {
|
||||||
else if x == true then "x is boolean true"
|
else if x == true then "x is boolean true"
|
||||||
else if x == false then "x is boolean false"
|
else if x == false then "x is boolean false"
|
||||||
else if x == null then "x is null"
|
else if x == null then "x is null"
|
||||||
else "x is probably a string `${substring 0 50 x}...'";
|
else if isInt x then "x is an integer `${toString x}'"
|
||||||
|
else if isString x then "x is a string `${substring 0 50 x}...'"
|
||||||
|
else "x is probably a path `${substring 0 50 (toString x)}'";
|
||||||
|
|
||||||
# trace the arguments passed to function and its result
|
# trace the arguments passed to function and its result
|
||||||
traceCall = n : f : a : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
|
traceCall = n : f : a : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
|
||||||
traceCall2 = n : f : a : b : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
|
traceCall2 = n : f : a : b : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
|
||||||
|
|
Loading…
Reference in New Issue