[Haskell-beginners] Cabal: Upgrading to the latest version of library

Daniel Fischer daniel.is.fischer at googlemail.com
Tue Nov 1 13:07:50 CET 2011


On Tuesday 01 November 2011, 11:50:45, Hugo Ferreira wrote:
> Hello,
> 
> Recently I had to update and install a newer version of a library.
> I executed the "cabal update", which downloads the latest package list.
> I had assumed that this command would also detect, build and install
> those libraries that have been upgraded. However this does not seem to
> be the case. I had to manually build the library and then use GHC's
> package manager do unregister the old version.

Unregistering the old version is not necessary, different versions of the 
same package can coexist. However, if some of the installed packages depend 
on the old version and some on the newer, those packages can generally not 
be used together, so unregistering is safer.

> 
> My question is: how does one check for and upgrade the cabal libraries
> automatically?

Not.

1. It's not possible to do it automatically since the latest versions of 
some packages can have incompatible dependencies, e.g. the latest foo 
depends on bar >= x.y && < x.(y+1), the latest baz however depends on bar 
>= x.(y+1).

Then you can't have foo together with the latest baz.

2. Usually, some not-updated packages depend on updated packages. Even if 
no incompatibility as above is introduced, that would cause a *lot* of 
recompilation and reinstallation. You don't inflict that on users unless 
they explicitly ask for it.

3. Often there's no real point in upgrading packages. Say the widely used 
package quux-x.y.z.d (think of something like text) had a typo in the 
haddocks, author fixes and uploads quux-x.y.z.e; thanks for recompiling my 
entire set of installed packages. Or a minor addition to the API that you 
don't need. Or a fix in a CPP macro that doesn't affect you, ...

Installation of newer versions of packages you already have should be a 
conscious decision by you, after pondering the consequences.




More information about the Beginners mailing list