haskell uninstall/clean 的 `stack` 命令?

haskell `stack` commands for uninstall/clean up?

stack setup 为项目下载并安装 GHC,

~/.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.

我想清理项目范围的 ghc 并从它们下载 dependencies/build 输出,以及我磁盘上所有其他与项目相关的东西。

除了手动删除它们之外没有别的办法吗?

stack clean 命令清除 .stack-work 中的本地缓存。

清理.stack缓存的功能尚未实现。请参阅此 GitHub 问题:

stack setup 为项目安装 GHC 但它在全局存储 GHC(因此如果该项目使用相同版本的 GHC,则无需为另一个项目再次安装 GHC)。

您只需 rm -rf .stack-work 即可清理项目本地构建缓存(构建的模块、项目的 github 依赖项等)。但是,rm -rf .stack-work 不适用于多包项目。只需执行 stack clean --full 即可完全清除项目的本地缓存。

要清理全局缓存,您只需执行 rm -rf ~/.stack

因此,再次引用问题讨论中的最新评论:

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.