summary refs log tree commit diff
path: root/pkgs/lib/debug.nix
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2009-05-24 10:57:46 +0000
committerMarc Weber <marco-oweber@gmx.de>2009-05-24 10:57:46 +0000
commit3157bb1098ca2bb16e793ec9946885562e3a4e10 (patch)
treeb8790ac877c6ea641cceee79c82c241be60eab8c /pkgs/lib/debug.nix
parentf7f938a1d15277fa11a2cbf75fe9c7d4344f25c3 (diff)
downloadnixpkgs-3157bb1098ca2bb16e793ec9946885562e3a4e10.tar
nixpkgs-3157bb1098ca2bb16e793ec9946885562e3a4e10.tar.gz
nixpkgs-3157bb1098ca2bb16e793ec9946885562e3a4e10.tar.bz2
nixpkgs-3157bb1098ca2bb16e793ec9946885562e3a4e10.tar.lz
nixpkgs-3157bb1098ca2bb16e793ec9946885562e3a4e10.tar.xz
nixpkgs-3157bb1098ca2bb16e793ec9946885562e3a4e10.tar.zst
nixpkgs-3157bb1098ca2bb16e793ec9946885562e3a4e10.zip
removed all __primops from nixpkgs
svn path=/nixpkgs/trunk/; revision=15693
Diffstat (limited to 'pkgs/lib/debug.nix')
-rw-r--r--pkgs/lib/debug.nix20
1 files changed, 12 insertions, 8 deletions
diff --git a/pkgs/lib/debug.nix b/pkgs/lib/debug.nix
index a58539ee3c4..18b5e1db9d4 100644
--- a/pkgs/lib/debug.nix
+++ b/pkgs/lib/debug.nix
@@ -1,4 +1,8 @@
-let lib = import ./default.nix; in
+let lib = import ./default.nix;
+
+inherit (builtins) trace attrNamesToStr isAttrs isFunction isList head substring attrNames;
+
+in
 
 rec {
 
@@ -20,20 +24,20 @@ rec {
 
   
   # 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;
-  attrNamesToStr = a : lib.concatStringsSep "; " (map (x : "${x}=") (__attrNames a));
+  traceShowVal = x : trace (showVal x) x;
+  traceShowValMarked = str: x: trace (str + showVal x) x;
+  attrNamesToStr = a : lib.concatStringsSep "; " (map (x : "${x}=") (attrNames a));
   showVal = x :
-      if __isAttrs x then
+      if isAttrs x then
           if x ? outPath then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }"
           else "x is attr set { ${attrNamesToStr x} }"
-      else if __isFunction x then "x is a function"
+      else if isFunction x then "x is a function"
       else if x == [] then "x is an empty list"
-      else if __isList x then "x is a list, first item is : ${showVal (__head x)}"
+      else if isList x then "x is a list, first item is : ${showVal (head x)}"
       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 starting, starting characters: ${__substring 0 50 x}..";
+      else "x is probably a string starting, starting characters: ${substring 0 50 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));