[Haskell] Help with cabal and windows

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sat May 30 13:13:15 EDT 2009


On Sat, 2009-05-30 at 09:06 -0700, newuser21 wrote:
> Hi, I am new to haskell.

BTW, in future it's better to ask these kinds of questions on the
haskell-cafe mailing list. These days the main haskell mailing list is
mostly for announcements etc.

> I have an programm whitch i want to compile for windows .It has cabal .I
> installed haskellplatform for windows, and  runhaskell setup.lhs configure
> runs fine.BUT when runhaskell setup.lhs build, then errors:
> Could not find module `Data.Generics':
>       it is a member of the hidden package `base-3.0.3.1'
>       it is a member of the hidden package `syb'
> WHY? syb is in the haskellplatform path?? I think it has  something to do
> with paths?

Quick solution:

Use this command instead:

  cabal configure
  cabal build

Alternatively, edit the package's .cabal file; find the bit that says
something like:

  build-depends: base

change it to say:

  build-depends: base < 4
or
  build-depends: base >= 4, syb


Here's what is actually going on:

When base 4 was released, the Data.Generics module was moved from being
in the base package to being in a separate package, syb. So that means
that if your package needs Data.Generics then you have a choice, you can
have it depend on base 3, or you can have it depend on base 4 and syb.

However currently the package just says that it needs "base" and does
not say if it needs version 3 or 4. But it's important to say because if
we just pick base 4 without also picking syb then it will not work. What
it likely going on is that the package you're looking at has not been
modified to take account of the change in base 4.

"runhaskell setup.lhs configure" always just picks the highest version
available, in this case 4. That's why it fails.

"cabal configure" uses a slightly smarter algorithm and in this case
will pick base 3 and so it'll work. However it is just making guesses to
make up for the lack of a correct specification in the .cabal file. This
backwards compatibility shim will not work for ever.

The specific error message is sadly a little confusing. It says the
other packages are hidden but that's only because runhaskell setup.lhs
build actually hides all packages other than the ones listed in
the .cabal file.

> Oh and on linux no problems. All worked fine compiles with no error.
> But the same happends as I installed haskellplatform under wine and
> tryied to build the program.

It's not actually a windows-specific problem. Perhaps on Linux you were
using a different version of ghc. It would have worked ok with ghc-6.8
which only comes with base 3. Or if you had used "cabal configure" then
that uses a smarter way of picking versions and would also have picked
version 3.

Duncan



More information about the Haskell mailing list