A tool suite to aid Haskell development using cabal-install
.
There are four tools in this repository:
cabal-env
: An experiment on whatcabal install --lib
could be.cabal-diff
: Compare API of different package versionscabal-bundler
: (ab)usecabal-install
solver to build standalone installation bundlescabal-deps
: An experiment on whatcabal outdated
could be.cabal-store-check
: A naive tool to try to repair cabal's nix-store
All tools are highly experimental, although I (Oleg Grenrus) use them daily.
There's also cabal-fmt
, a .cabal
file formatter, but it's more standalone tool.
To install individual executables from this repository,
- Make sure you have
GHC-8.2
andcabal-install-3.0
or later installed. - Clone it with
git clone https://github.com/phadej/cabal-extras.git
- Install individual executables with
make install-cabal-env
,make install-cabal-deps
etc.
You can pass flags to cabal install
by setting INSTALL_FLAGS
, e.g.
make INSTALL_FLAGS="--installdir $HOME/bin --install-method copy" install-cabal-env
TBW
TBW
TBW
$ cabal-env optics
$ ghci
Prelude> import Optics
Prelude Optics>
TBW
This is a small script which can find some broken packages in cabal nix-store. It's a proof-of-concept of
# Check if store package db is inconsistent
$ cabal-store-check
...
[ 0.64132] error: haskell-ci-0.3.20190327-98543f1828739a9ad62f8722220f5d812f7f4a13f6fe2745a286c227593452b9 interface file for HaskellCI is missing
...
# You can remove broken packages with, which would repair the state
$ cabal-store-check --repair
This is another small script to reduce size of cabal's nix-store.
# Add possible current projects dependencies as in direct root,
# and print reclaiming information
$ cabal-store-gc
...
...
[ 16.89166] info: 262 components are referenced from the roots
[ 16.89714] info: 183 components are in the store
[ 16.89726] info: 393 components can be removed from the store
[ 17.71338] info: 2328 MB can be freed
# If you want to perform the cleanup
$ cabal-store-gc --collect
# For more information, see
$ cabal-store-gc --help
There are three kind of roots, which retain the packages in the store:
- executables in
installdir
. These are automatic roots. - packages references from environments in
~/.ghc/.../environments/...
. These are also automatic roots. - indirect roots, which are links from
~/.cabal/store/roots
toplan.json
s elsewhere in the file system. Indirect links allow to retain development project dependencies. New indirect roots can be added with--add-project-root
or--add-root
actions.