Search code examples
haskellghccabal

how to obtain cabal default config location


Is there a way to obtain the default cabal config directory, i.e. the path you would specify in ghc-pkg.exe init {path}?

I wanted it in a script to automatically remove that folder for repairing/re-installing ghc.

Thanks.


Solution

  • Per @user2407038's comments, I obtained the location of the cabal config location with

    cabal help | tail -n1
    

    and removed the folder using

    rm -rf `cabal help | tail -n1 | xargs dirname`