I am trying to learn cabal, and have tested several my own little projects, now I want to clean them up.
Basically, if I am working without a sandbox
, my workflow is:
cabal init
src/Mylib.hs
, and then edit mylibname.cabal
filecabal build
cabal repl
and test my codecabal install
Now, I see my own project:
~/.cabal/lib/x86-64-linux-ghc-7.10.1
~/.ghc/package.conf.d
I can write import Mylib
in my other haskell source code, so I think the package is successfully installed.
Then I want to uninstall the package, as the package itself is just meaningless experiment code.
I read this article, who says that:
There is no "cabal uninstall" command. You can only unregister packages with ghc-pkg:
ghc-pkg unregister
so I run
ghc-pkg unregister mylibname
Now, it seems that the package is unregistered in ~/ghc/package.conf.d
, however, there is still a compiled library in ~/.cabal/lib/x86-64-linux-ghc-7.10.1
.
So, how could I completly remove my project, could I just rm -rf
the library in ~/.cabal
?
You can delete the files yourself from the packages directory. However, the reason no command to do so is provided is there's in general no guarantee something may not have linked against them elsewhere, and so such deletions may cause breakages. That said, there's also a tool that goes and does the deletion for you if you really want it.
http://hackage.haskell.org/package/cabal-uninstall
And there's a tool with a bit more functionality that also lets you figure out what packages have no reverse deps, so at least no other packages break:
https://github.com/iquiw/cabal-delete
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With