Skip to content

add flag to dump module and package dependencies

You can already dump module and package dependencies with -M -include-pkg-deps, but it wants to modify a Makefile, so it's not so convenient for things that are not make. For other build systems, it would be convenient to get this on stdout in an easily parseable form. Say X/A.hs imports Y/B.hs, which imports Z/C.hs, and they all use package 'base' and 'containers':

% ghc -Mstdout X/A.hs
X/A.h
Y/B.hs
Y/B.hs
Z/C.hs

base containers
%

I don't know about what the output format should be, but assuming no newlines in filenames, and package names never have spaces, it seems simplest to do something like:

[src ++ "\n" ++ dest ++ "\n" | (src, dest) <- moduleDeps] ++ "\n" ++ unwords packageDeps

It could use haskell syntax like --info, but then you'd need a full haskell parser just to read it, which is not a problem for shake, but probably inconvenient for other build systems.

Trac metadata
Trac field Value
Version
Type FeatureRequest
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information