QRE: Cabal and simultaneous installations of the same package

Simon Peyton Jones simonpj at microsoft.com
Mon May 11 16:17:31 UTC 2015

Exactly!  It’s so close!  GHC has all the necessary infrastructure.  All we need is for Cabal to recognise that it’s possible to install two instances of A-2.0.  My fingers can almost touch it.  Go Vishal!


From: Boespflug, Mathieu [mailto:m at tweag.io]
Sent: 11 May 2015 16:42
To: Simon Peyton Jones; Gershom B; Mikhail Glushenkov; Duncan Coutts (duncan at well-typed.com); Ryan Trinkle; haskell-infrastructure at community.galois.com; cabal-devel at haskell.org; ghc-devs at haskell.org; Vishal Agrawal; Haskell Libraries
Subject: Re: QRE: Cabal and simultaneous installations of the same package

As I think Simon was saying earlier, think of this feature as allowing strictly more installation plans to succeed, while still keeping to the exact same model that we use today of just one instance of a lib in any given binary.

Currently, if you install B-0.1 and then install A-2.0 that has a constraint B>=0.1, then you can't build an app that depends on both A and B-0.2. That's counter intuitive because had you started from an empty sandbox, then you would be able to build the app!

The reason is that currently you can only have a single instance of A-2.0 installed. The proposal is *not* to allow building an app against an A-2.0 built against B-0.1 and against B-0.2 simultaneously. It's to allow multiple instances of A-2.0 in the same package database, and teach Cabal to handle that, so that an app can ask for an A-2.0 that is built against the right version of B, no matter what, and link that in.

In your example, an app wouldn't get both C 1.0 and 2.0. It would get whichever one of those fits the constraints of both A and B, or the build will fail if no such C exists.

Since only one instance of a library ever makes it into a binary, as is the case currently, no particular problem arises with linking in external dependencies such as C code.

On 11 May 2015 at 14:52, Daniel Trstenjak <daniel.trstenjak at gmail.com<mailto:daniel.trstenjak at gmail.com>> wrote:

Hi Simon,

On Mon, May 11, 2015 at 11:27:58AM +0000, Simon Peyton Jones wrote:
> Well, no one is actually suggesting that!

But you're just getting it automatically if you're depending e.g.
on the libraries A and B, and A depends on C 1.0 and B depends on C 2.0.

Currently you can't build this dependency graph, right? And with
this proposed feature you will be getting C 1.0 and 2.0 into your binary.

Perhaps a even more nasty case is, if you're using a haskell library
which wraps a stateful c library, and now you're having multiple
versions of the same haskell library operating on the same c library state.

ghc-devs mailing list
ghc-devs at haskell.org<mailto:ghc-devs at haskell.org>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150511/c1f3568d/attachment-0001.html>

More information about the ghc-devs mailing list