query
On this page

trace

lib.fileset.trace

Docs pulled from | This Revision | 10 minutes ago


Incrementally evaluate and trace a file set in a pretty way. This function is only intended for debugging purposes. The exact tracing format is unspecified and may change.

This function takes a final argument to return. In comparison, traceVal returns the given file set argument.

This variant is useful for tracing file sets in the Nix repl.

Inputs

fileset

The file set to trace.

This argument can also be a path, which gets implicitly coerced to a file set.

val

The value to return.

Type

trace :: FileSet -> Any -> Any

Examples

lib.fileset.trace usage example

trace (unions [ ./Makefile ./src ./tests/run.sh ]) null
=>
trace: /home/user/src/myProject
trace: - Makefile (regular)
trace: - src (all files in directory)
trace: - tests
trace:   - run.sh (regular)
null

Noogle detected

Implementation

The following is the current implementation of this function.

trace =
    fileset:
    let
      # "fileset" would be a better name, but that would clash with the argument name,
      # and we cannot change that because of https://github.com/nix-community/nixdoc/issues/76
      actualFileset = _coerce "lib.fileset.trace: Argument" fileset;
    in
    seq (_printFileset actualFileset) (x: x);