N. Virgo
N. Virgo

Reputation: 8431

How to resolve broken dependencies in cabal?

I'm a beginner at Haskell, and I've been merrily using cabal to install everything that I thought I might need, assuming it would work like port or homebrew, resolving all dependencies for me and keeping things up to date so they won't break, etc. However, now when trying to instal the lenses library I get this message:

In order, the following would be installed:
base-orphans-0.5.4 (new package)
distributive-0.5.0.2 (new version)
comonad-5 (new version)
bifunctors-5.4.1 (new package)
mtl-2.2.1 (reinstall) changes: transformers-0.5.2.0 -> 0.4.3.0
exceptions-0.8.3 (new package)
prelude-extras-0.4.0.3 (new package)
profunctors-5.2 (new package)
reflection-2.1.2 (new package)
semigroupoids-5.1 (new package)
free-4.12.4 (new package)
adjunctions-4.3 (new package)
kan-extensions-5.0.1 (new package)
lens-4.14 (new package)
cabal: The following packages are likely to be broken by the reinstalls:
parsec-3.1.11
network-uri-2.6.1.0
hackage-security-0.5.2.2
HTTP-4000.3.3
Use --force-reinstalls if you want to install anyway.

Well, breaking HTTP and something called "security" doesn't sound like a good idea, and my code relies on Parsec. What's the proper way to resolve this situation? Should I use --force-reinstalls and expect things to not really break? Or let those packages break and then reinstall them, assuming that's possible if the HTTP package is broken? Or do I have to make my own choices about which packages to install or not to install, knowing that some will conflict each other?

Part of the problem might be that I initially didn't realise that some of the packages on hackage aren't really production-quality code, so I do have a lot of dependencies that I don't really need. Perhaps the solution is to uninstall those packages and their dependencies. However cabal --help doesn't reveal any kind of uninstall command, so I'm a bit lost with how to do that.

Upvotes: 0

Views: 870

Answers (1)

Daniel Wagner
Daniel Wagner

Reputation: 152682

The standard technique is to tell cabal that you don't mind reinstalling the packages that would be broken. You can do this with something like

cabal install lenses parsec-3.1.11 network-uri-2.6.1.0 hackage-security-0.5.2.2 HTTP-4000.3.3

There are further details on what's happening here on this fine introduction to cabal packages, especially the section labeled "The Pigeon Drop Con".

Upvotes: 1

Related Questions