Cabal says parsec-3.1.1 not available, ghc-pkg says it is available

Duncan Coutts duncan.coutts at
Mon Feb 28 16:33:24 CET 2011

On Sun, 2011-02-27 at 18:24 +0100, Henning Thielemann wrote:
> I am lost. Cabal-install says 'there is no available version of parsec that 
> satisfies ==3.1.1', but ghc-pkg says I have this parsec version installed.
> mypkg$ cabal install --constraint=parsec==3.1.1

So you are installing the package in the current directory.

> Resolving dependencies...
> cabal: There is no available version of parsec that satisfies ==3.1.1

So what is happening is that the package in the current dir does not
depend (directly or indirectly) on parsec. As an optimisation, Cabal's
dep resolver trims out all packages that are not in the transitive
closure of the dependencies of the package(s) you're installing, and as
parsec is not in that set then it gets ignored too. Then the dep solver
comes along and tries to apply the constraint parsec == 3.1.1 which
fails because there are no available instances of parsec left (as they
were all trimmed out earlier since they will never be needed).

Strictly speaking this constraint failure is spurious because it's ok
for parsec to be over-constrained since it is not needed. Ideally what
we would like to happen here is for the constraint to simply be ignored,
perhaps with a warning that it was unnecessary.

As it happens, I've been working on the dep resolver recently and the
changes I'm making will mean that superfluous constraints will indeed be
ignored. I'll think about whether we can easily warn too.


More information about the cabal-devel mailing list