开发者

Package versioning clashes in Cabal

Forgive me if this is a FAQ but I'm a bit puzzled about how to get around this problem properly.

I recently downloaded the package TagSoup which installed fine with the latest version 0.12.2

Then I installed the package download-curl which installed fine with the latest version. What I failed to realise was, download-curl depends on TagSoup with a version =< 0.11, so as part of the installation process Cabal downloaded an older version of TagSoup too.

This is a problem because I want to use both libraries (the latest version of TagSoup AND download-curl) - and when you do for some reason GHCI gets in a bit of a mess.

My question is, is there a way of specifying versions in your import statements, i.e.

import Text.Html.TagSoup-0.12.2

or is this a no go? I'm thinking not.

The only way I got around this was to download the d开发者_开发技巧ownload-curl source, modify the .cabal file to use TagSoup-0.12.2 and reinstalled the package with my little "hack" in place which works as I would expect it to - but I don't think this is the solution

Any help would be appreciated


Normally one specifies the required version in the .cabal file. There is an extension syntax for specific package imports (-XPackageImports) but it's usually better to let Cabal deal.

That said, yes, if you need to use both then you enter the dark realm of diamond dependencies. Yours is pretty much the only solution available currently. -XPackageImports is not a good idea here, as trying to use two versions of the same library in the same program probably won't link and almost certainly will dump core at runtime if it does manage to link without duplicate symbols.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜