Skip to content

(builtins.trace el) support #25

@qknight

Description

@qknight

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions