trace
builtins.trace
Primop
Docs pulled from | This Revision | 3 days ago
Nix manual
Takes 2 arguments
e1, e2
Evaluate e1 and print its abstract syntax representation on standard error. Then return e2. This function is useful for debugging.
If the
debugger-on-trace
option is set to true and the --debugger flag is given, the
interactive debugger is started when trace is called (like
break).
Noogle detected
Detected Type
trace :: a -> b -> b
Implementation
This function is implemented in c++ and is part of the native nix runtime.
static void prim_trace(EvalState & state, const PosIdx pos, Value ** args, Value & v)
{
state.forceValue(*args[0], pos);
if (args[0]->type() == nString)
printError("trace: %1%", args[0]->string_view());
else
printError("trace: %1%", ValuePrinter(state, *args[0]));
if (state.settings.builtinsTraceDebugger) {
state.runDebugRepl(nullptr);
}
state.forceValue(*args[1], pos);
v = *args[1];
}