stack dot command¶
A package and its dependencies and the direct dependency relationships between
them form a directed graph. Graphviz is open source
software that visualises graphs. It provides the DOT language for defining
graphs and the
dot executable for drawing directed graphs. Graphviz is
available to download for Linux, Windows,
macOS and FreeBSD.
stack dot produces output, to the standard output channel, in the DOT language
to represent the relationships between your packages and their dependencies.
- external dependencies are excluded from the output. Pass the flag
--externalto include external dependencies;
basepackage and its dependencies are included in the output. Pass the flag
baseand its dependencies;
- there is no limit to the depth of the resolution of dependencies. Pass the
--depth <depth>option to limit the depth;
- all relevant packages are included in the output. Pass the
--prune <packages>option to exclude the specified packages, where
<packages>is a list of package names separated by commas;
- all packages in the project are included in the output. However, the target
for the command can be specified as an argument. It uses the same format
- test components of the packages in the project are excluded from the output.
Pass the flag
--testto include test components; and
- benchmark components of the packages in the project are excluded from the
output. Pass the flag
--benchto include benchmark components.git p
Pass the option
--flag <package_name>:<flag_name> or
--flag <package_name>:-<flag_name> to set or unset a Cabal flag. This
option can be specified multiple times.
Pass the flag
--global-hints to use a hint file for global packages. If a hint
file is used, GHC does not need to be installed.
The following examples are based on a version of the
wreq package. In each case, the
stack dot is piped as an input into Graphviz's
dot produces output in the form of a PNG file named
A simple example:
Include external dependencies:
Include external dependencies, limit the depth and save the output from
stack dotas an intermediate file (
Include external dependencies, exclude
baseand limit the depth:
Include external dependencies and prune
baseand other packages:
Include external dependencies, prune
baseand other packages, and use a different Graphviz executable to draw the graph:
twopiexecutable draws graphs in a radial layout.