Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

haskell `stack` commands for uninstall/clean up?

stack setup download and installs GHC for project,

~/.stack/programs,
~/.stack/snapshots and somewhere else which I don't know yet)

stack build downloads dependencies and build them.
~/.stack/setup-exe-cache and somewhere else.

I want to clean up project-wide ghc and downloaded dependencies/build output from them, plus all the other project related things on my disk.

There's no way to do this other than just manually delete them?

like image 299
Heath Kim Avatar asked Feb 05 '18 17:02

Heath Kim


1 Answers

stack clean command clears local cache in .stack-work.

The feature for cleaning .stack cache is not implemented yet. See this GitHub issue:

  • https://github.com/commercialhaskell/stack/issues/133

stack setup installs GHC for project but it stores GHC globally (so you don't need to install GHC again for another project if this project uses same version of GHC).

You can just do rm -rf .stack-work to clean project local build cache (built modules, github dependencies for project, etc.). Though, rm -rf .stack-work won't work for multipackage project. Just do stack clean --full to clear local cache completely for project.

To clean global cache, you can just do rm -rf ~/.stack.

Thus, again, citing latest comment from issue discussion:

The garbage collection question definitely needs to be answered in some form or another. If possible, I think I might find a documentation solution preferable to a new command. It would be great if the manual discussed the directory structure of ~/.stack and explained what directories were safe to delete.

like image 163
Shersh Avatar answered Sep 17 '22 06:09

Shersh