Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(builtins.trace el) support #25

Open
qknight opened this issue Oct 9, 2023 · 0 comments
Open

(builtins.trace el) support #25

qknight opened this issue Oct 9, 2023 · 0 comments

Comments

@qknight
Copy link
Member

qknight commented Oct 9, 2023

When doing debugging in nix one uses builtins.trace but the tour currently prints the output to the F12 console and the user can't easily access this.

with import <nixpkgs> { };
with lib;
let
  list = ["a" "b" "a" "c" "d" "a"];
  intList = [ 1 2 3 ];
  countA = l: fold (el: c: if el == "a" then c + 1 else c) 0 l;
  mulB = l: lib.fold (el: c: (builtins.trace el) [(el * 2)] ++ c) [8] l;
in
rec {
  example = lib.fold (x: y: x + y) "z" ["a" "b" "c"]; #is "abcz"
  ex0 = countA list; #should be 3
  ex1 = mulB intList; #should be [ 2 4 6 8 ]
}

It would be good to have a pane dedicated to this debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant