Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use "-ddump-minimal-imports" with stack

I am such a big fan of stack, that I've removed any independent cabal and ghc executables completely from my machine (letting stack install whatever it needs in its own mysterious ~/.stack/ directory)....

However, it looks like some flags aren't working properly under stack. For instance, I want to use -ddump-minimal-imports. In cabal this would be

cabal build --ghc-option=-ddump-minimal-imports

The obvious translation would be

stack build --ghc-options -ddump-minimal-imports

This runs, but produces nothing but the executable (as far as I can tell, at least.... Perhaps the output is somewhere in the mysterious ~/.stack dir).

Is there a way to do this?

like image 380
jamshidh Avatar asked Oct 05 '15 23:10

jamshidh


1 Answers

I just tried this, using stack build --ghc-options=-ddump-minimal-imports, and it produced output files in ./.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/, e.g.:

$ stack clean

$ stack build --ghc-options=-ddump-minimal-imports
stack-0.1.5.0: configure
Configuring stack-0.1.5.0...
stack-0.1.5.0: build
Preprocessing library stack-0.1.5.0...
[ 1 of 69] Compiling Data.Set.Monad   ( src/Data/Set/Monad.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Data/Set/Monad.o )
[ 2 of 69] Compiling Data.Attoparsec.Combinators ( src/Data/Attoparsec/Combinators.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Data/Attoparsec/Combinators.o )
[ 3 of 69] Compiling Network.HTTP.Download.Verified ( src/Network/HTTP/Download/Verified.hs, .stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Network/HTTP/Download/Verified.o )
^Cuser interrupt

$ find . -name '*imports*'
./.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Data.Attoparsec.Combinators.imports
./.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Data.Set.Monad.imports
./.stack-work/dist/x86_64-osx/Cabal-1.22.4.0/build/Network.HTTP.Download.Verified.imports
like image 140
Emanuel Borsboom Avatar answered Oct 13 '22 13:10

Emanuel Borsboom