[Haskell-cafe] Cabal package bug?

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Feb 26 04:24:00 EST 2009


On Thu, 2009-02-26 at 08:00 +0000, jpaulo at di.uminho.pt wrote:
> hello all,
> 
> I've used cabal to install package haskell-src-1.0.1.3 under ghc 6.10.1;
> 
> Apparently, it worked fine!
> 
> However, function parseModule has been given the type:
> 
> parseModule ::
>    String
>    -> ParseResult haskell-src-1.0.1.3:Language.Haskell.Syntax.HsModule
> 
> instead of simply
> 
> parseModule ::
>    String
>    -> ParseResult HsModule
> 
> as described in the Language.Haskell.Parser module;
> 
> This causes conflicting types for all my other modules!

This is the "diamond dependency problem"

http://blog.well-typed.com/2008/04/the-dreaded-diamond-dependency-problem/

> Can anyone please help me on this?

Most likely you've got two versions of haskell-src installed and some
packages are built against one version and some built against another.
GHC is showing you the fully qualified name here exactly because it
would otherwise refer to a different version.

So here's the thing, cabal-install makes sure that whatever you install
is self-consistent (no conflicting deps). So when you did
$ cabal install haskell-src
and it installed haskell-src-1.0.1.3, it made sure that the deps of that
package were consistent. That *does not* mean that it's dependencies are
consistent with every other package you've got installed. It does not
guarantee global consistency. Only local consistency of the thing you
asked to install.

So what could you do. Well if you were using a .cabal file for your own
program then cabal install on that would also guarantee consistency for
the dependencies of your package. It would try to achieve that from the
current situation by rebuilding packages against different versions of
their dependencies.

If you don't have a .cabal file for your project you can still achieve
the same effect by asking cabal install to install all of the packages
that your project depends on:

cabal install --dry-run haskell-src blah blah blah

That's asking it to find a way of installing all those packages with
consistent deps (which may involve reinstalling some).

The --dry-run will make it show a list of what it would install and some
indication of why. If you use -v too it'll tell you for example if it's
going to rebuild a package against a different version of one of it's
dependencies.

Duncan



More information about the Haskell-Cafe mailing list