[ANN] cabal-clean (new tool)

=== Wondering where your disk space goes with too many Haskell projects compiled with too many GHC versions? === https://hackage.haskell.org/package/cabal-clean https://github.com/andreasabel/cabal-clean `cabal-clean` is a small executable that removes outdated cabal build artifacts from `dist-newstyle`. A build tree is considered outdated if there is one with either - a newer version of the package you are building, or - a newer minor version of the GHC compiler. In contrast to `cabal clean`, the tool `cabal-clean` retains the latest build trees for each GHC major version. Thus, it is geared towards multi-GHC development. Example: (self-applied to cabal-clean's build directory) --- 3.7M ghc-8.8.4 /cabal-clean-0.1.20210815 --- 3.5M ghc-8.10.6/cabal-clean-0.1.20210815 --- 3.7M ghc-9.0.1 /cabal-clean-0.1.20210815 --- 3.5M ghc-8.10.6/cabal-clean-0.1.20210924 +++ 3.6M ghc-8.10.7/cabal-clean-0.1.20210924 +++ 3.7M ghc-9.0.1 /cabal-clean-0.1.20210924 The directories prefixed with --- will be deleted, the ones with +++ retained. Disclaimers: 1. cabal-clean does not check whether deletion will cause dangling references like broken symlinks etc. (Could happen if you created a symlink to an executable that resides in one of the deleted build directories.) 2. cabal-clean does not read nor utilize information from the .cabal file. 3. Calls `du` ("disk usage"), so, might not work on Windows. Enjoy, Andreas

Il 24 settembre 2021 alle 19:09 Andreas Abel ha scritto:
=== Wondering where your disk space goes with too many Haskell projects compiled with too many GHC versions? ===
https://hackage.haskell.org/package/cabal-clean https://github.com/andreasabel/cabal-clean
`cabal-clean` is a small executable that removes outdated cabal build artifacts from `dist-newstyle`.
Godsent tool, thanks for writing it! —F

On Fri, Sep 24, 2021 at 07:17:47PM +0200, Francesco Ariis wrote:
Il 24 settembre 2021 alle 19:09 Andreas Abel ha scritto:
=== Wondering where your disk space goes with too many Haskell projects compiled with too many GHC versions? ===
https://hackage.haskell.org/package/cabal-clean https://github.com/andreasabel/cabal-clean
`cabal-clean` is a small executable that removes outdated cabal build artifacts from `dist-newstyle`.
Godsent tool, thanks for writing it! —F
+1. Please consider a mode that traverses the entire filesystem :) Cheers, Fraser
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

God send, thanks. Greetings, Branimir.
On 25.09.2021., at 01:55, Fraser Tweedale
wrote: On Fri, Sep 24, 2021 at 07:17:47PM +0200, Francesco Ariis wrote:
Il 24 settembre 2021 alle 19:09 Andreas Abel ha scritto:
=== Wondering where your disk space goes with too many Haskell projects compiled with too many GHC versions? ===
https://hackage.haskell.org/package/cabal-clean https://github.com/andreasabel/cabal-clean
`cabal-clean` is a small executable that removes outdated cabal build artifacts from `dist-newstyle`.
Godsent tool, thanks for writing it! —F
+1.
Please consider a mode that traverses the entire filesystem :)
Cheers, Fraser
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

This seems like a useful tool, but the naming might be confusing: "cabal-install" generally means "cabal install" but "cabal-clean" and "cabal clean" have similar goals but behave differently. Tom On Fri, Sep 24, 2021 at 07:09:49PM +0200, Andreas Abel wrote:
=== Wondering where your disk space goes with too many Haskell projects compiled with too many GHC versions? ===
https://hackage.haskell.org/package/cabal-clean https://github.com/andreasabel/cabal-clean
`cabal-clean` is a small executable that removes outdated cabal build artifacts from `dist-newstyle`.
A build tree is considered outdated if there is one with either
- a newer version of the package you are building, or - a newer minor version of the GHC compiler.
In contrast to `cabal clean`, the tool `cabal-clean` retains the latest build trees for each GHC major version. Thus, it is geared towards multi-GHC development.
Example: (self-applied to cabal-clean's build directory)
--- 3.7M ghc-8.8.4 /cabal-clean-0.1.20210815 --- 3.5M ghc-8.10.6/cabal-clean-0.1.20210815 --- 3.7M ghc-9.0.1 /cabal-clean-0.1.20210815 --- 3.5M ghc-8.10.6/cabal-clean-0.1.20210924 +++ 3.6M ghc-8.10.7/cabal-clean-0.1.20210924 +++ 3.7M ghc-9.0.1 /cabal-clean-0.1.20210924
The directories prefixed with --- will be deleted, the ones with +++ retained.
Disclaimers:
1. cabal-clean does not check whether deletion will cause dangling references like broken symlinks etc. (Could happen if you created a symlink to an executable that resides in one of the deleted build directories.)
2. cabal-clean does not read nor utilize information from the .cabal file.
3. Calls `du` ("disk usage"), so, might not work on Windows.
Enjoy, Andreas _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.

If this solves a particular use-case and doesn't involve a ton of code, I'd gladly accept a port and hide it behind a flag in cabal-install On Fri, Sep 24, 2021 at 11:53 AM, amindfv--- < haskell-cafe@haskell.org > wrote:
This seems like a useful tool, but the naming might be confusing: "cabal-install" generally means "cabal install" but "cabal-clean" and "cabal clean" have similar goals but behave differently.
Tom
On Fri, Sep 24, 2021 at 07:09:49PM +0200, Andreas Abel wrote:
=== Wondering where your disk space goes with too many Haskell projects compiled with too many GHC versions? ===
https:/ / hackage. haskell. org/ package/ cabal-clean ( https://hackage.haskell.org/package/cabal-clean ) https:/ / github. com/ andreasabel/ cabal-clean ( https://github.com/andreasabel/cabal-clean )
`cabal-clean` is a small executable that removes outdated cabal build artifacts from `dist-newstyle`.
A build tree is considered outdated if there is one with either
- a newer version of the package you are building, or - a newer minor version of the GHC compiler.
In contrast to `cabal clean`, the tool `cabal-clean` retains the latest build trees for each GHC major version. Thus, it is geared towards multi-GHC development.
Example: (self-applied to cabal-clean's build directory)
--- 3.7M ghc-8.8.4 /cabal-clean-0.1.20210815 --- 3.5M ghc-8.10.6/cabal-clean-0.1.20210815 --- 3.7M ghc-9.0.1 /cabal-clean-0.1.20210815 --- 3.5M ghc-8.10.6/cabal-clean-0.1.20210924 +++ 3.6M ghc-8.10.7/cabal-clean-0.1.20210924 +++ 3.7M ghc-9.0.1 /cabal-clean-0.1.20210924
The directories prefixed with --- will be deleted, the ones with +++ retained.
Disclaimers:
1. cabal-clean does not check whether deletion will cause dangling references like broken symlinks etc. (Could happen if you created a symlink to an executable that resides in one of the deleted build directories.)
2. cabal-clean does not read nor utilize information from the .cabal file.
3. Calls `du` ("disk usage"), so, might not work on Windows.
Enjoy, Andreas _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http:/ / mail. haskell. org/ cgi-bin/ mailman/ listinfo/ haskell-cafe ( http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe ) Only members subscribed via the mailman list are allowed to post.
_______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http:/ / mail. haskell. org/ cgi-bin/ mailman/ listinfo/ haskell-cafe ( http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe ) Only members subscribed via the mailman list are allowed to post.

cabal-clean 0.2 has just been released! https://hackage.haskell.org/package/cabal-clean-0.2.20220819 New: - Also removes builds by GHCs which are no longer in the PATH (so, arepresumably uninstalled). - Fixed to work also under Windows. On 2021-09-24 19:09, Andreas Abel wrote:
=== Wondering where your disk space goes with too many Haskell projects compiled with too many GHC versions? ===
https://hackage.haskell.org/package/cabal-clean https://github.com/andreasabel/cabal-clean
`cabal-clean` is a small executable that removes outdated cabal build artifacts from `dist-newstyle`.
A build tree is considered outdated if there is one with either
- a newer version of the package you are building, or - a newer minor version of the GHC compiler.
In contrast to `cabal clean`, the tool `cabal-clean` retains the latest build trees for each GHC major version. Thus, it is geared towards multi-GHC development.
Example: (self-applied to cabal-clean's build directory)
--- 3.7M ghc-8.8.4 /cabal-clean-0.1.20210815 --- 3.5M ghc-8.10.6/cabal-clean-0.1.20210815 --- 3.7M ghc-9.0.1 /cabal-clean-0.1.20210815 --- 3.5M ghc-8.10.6/cabal-clean-0.1.20210924 +++ 3.6M ghc-8.10.7/cabal-clean-0.1.20210924 +++ 3.7M ghc-9.0.1 /cabal-clean-0.1.20210924
The directories prefixed with --- will be deleted, the ones with +++ retained.
Disclaimers:
1. cabal-clean does not check whether deletion will cause dangling references like broken symlinks etc. (Could happen if you created a symlink to an executable that resides in one of the deleted build directories.)
2. cabal-clean does not read nor utilize information from the .cabal file.
3. Calls `du` ("disk usage"), so, might not work on Windows.
Enjoy, Andreas _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.
participants (6)
-
amindfv@mailbox.org
-
Andreas Abel
-
Branimir Maksimovic
-
Emily Pillmore
-
Francesco Ariis
-
Fraser Tweedale