On Mon, Feb 6, 2017 at 10:00 AM, Sven Panne <svenpanne@gmail.com> wrote:
2017-02-04 19:19 GMT+01:00 Geraldus <heraldhoi@gmail.com>:

I want to perform some cleanup deleting obsolete compilers located in ~/.stack folder. I know stack places them into ~/.stack/programs/<platform>/ directory, however I think there are also should be something else related, e.g. docs and libs, and especially packages that was built when I used old LTS snapshots. [...]

It's good to hear that I'm not alone with such an obvious(?) undocumented use case... :-) I often want to say something like "Nuke away everything related to nightly-X-Y-Z" (garbage-collecting away any GHC on the way, too) or "Nuke GHC X.Y and all related snapshots". The last time I looked at stack's documentation, I couldn't figure out how to do that, so from time to time I completely remove ~/.stack, but that can't be the recommended way to do this. ~/.stack gets *huge* after some time, so some easy administrative interface for it would be nice.



Personally, I have always just wiped out the entire ~/.stack directory when it gets too big, I just don't have the patience to individually deal with each snapshot directory. If you just want to get rid of the compiled libraries, you can nuke ~/.stack/snapshots instead, but personally I've found it convenient to get rid of my install GHCs occasionally because I usually don't need them all anymore (e.g. I don't need GHC 7.10.2 or 7.8.4 for any code I've been working on in the past few months).

Could there be a nice `gc` command to more intelligently delete stuff that hasn't been used recently? Probably, but I don't think the demand has been very high for it: people seem to either not care about disk space much, or don't mind the occasionally tactical nuke.

(FWIW: I would also periodically nuke my ~/.cabal and ~/.ghc directories in the past.)

Michael