[Haskell-cafe] Fwd: How to do automatic reinstall of all dependencies?

Alexander Kjeldaas alexander.kjeldaas at gmail.com
Thu Apr 25 11:03:28 CEST 2013


This is not what you asked for, but reinstalling *all
dependencies*probably isn't such a good idea, because ultimately some
dependencies are
shipped with GHC and you might not be able to reinstall them.

Here is a useful formula I developed to avoid cabal-hell and always *upgrade
* dependencies whenever a new package is installed.

$ cabal install --upgrade-dependencies  `eval echo $(ghc-global-constraints
)` <package-name>

What this does is fix the version of all global packages.  These are by
default the ones that are shipped with ghc, so the above command explicitly
excludes those from being upgraded.

The ghc-global-constraints function is something I have in my .bashrc file,
and it looks like this:

function ghc-global-constraints() {
    ghc-pkg list --global | tail -n+2  | head -n-1 | grep -v '(' | while
read a; do
        VER=${a##*-}
        PKG=${a%-*}
        echo -n "--constraint='$PKG==$VER' "
    done
}

This technique depends on actually fixing broken package dependencies, but
today that's usually just a github fork away, and often easier than dealing
with multiple cabal-dev installations IMO.

Alexander



On Thu, Apr 25, 2013 at 12:29 AM, capn.freako at gmail.com <
capn.freako at gmail.com> wrote:

>
>
> -db
>
> ----- Forwarded message -----
> From: "Captain Freako" <capn.freako at gmail.com>
> Date: Tue, Apr 23, 2013 9:21 pm
> Subject: How to do automatic reinstall of all dependencies?
> To: <haskell-cafe at haskell.org>
>
> Hi all,
>
> Does anyone know why the following is not working, as an automatic way of
> reinstalling all dependencies?:
>
> dbanas at dbanas-lap:~/prj/AMI-Tool$ cabal install --only-dependencies
> --reinstall --force-reinstalls parsec
> Resolving dependencies...
> All the requested packages are already installed:
> Use --reinstall if you want to reinstall anyway.
> dbanas at dbanas-lap:~/prj/AMI-Tool$
>
> Thanks,
> -db
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130425/8128cfd3/attachment.htm>


More information about the Haskell-Cafe mailing list