Stack can tell you what the dependency graph for the transitive closure of all your packages looks like, using the stack dot command, but only in GraphViz format. That's fine for the purposes of visualization by the end user, but brittle for other machines to parse.
We could have say stack ls dependencies --graph, that lists the dependencies together with their direct dependencies, i.e. an adjacency list. Either something like
conduit: base bytestring directory exceptions ...
primitive: base ghc-prim transformers
or as JSON output:
{ "conduit": ["base", "bytestring", "directory", "exceptions", ...], "primitive": [...]}
cc @aherrmann