From 7482474aefc3435d94b6932337085727517688db Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Sat, 14 Nov 2009 20:14:15 +0000 Subject: [PATCH] * Improve showVal: handle integer and strings. svn path=/nixpkgs/trunk/; revision=18346 --- pkgs/lib/debug.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/lib/debug.nix b/pkgs/lib/debug.nix index 4f757653bc0..5d411b864ec 100644 --- a/pkgs/lib/debug.nix +++ b/pkgs/lib/debug.nix @@ -1,6 +1,6 @@ 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 @@ -37,7 +37,10 @@ rec { else if x == true then "x is boolean true" else if x == false then "x is boolean false" 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 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));