Search code examples
haskellcabalhackage

Trouble installing hstats library from hackage using cabal


When I try to install the hstats package

$ cabal install hstats

I get the following error:

src/Math/Statistics.hs:1:1:
    Ambiguous module name `Prelude':
      it was found in multiple packages: base haskell98-2.0.0.2
Failed to install hstats-0.3
cabal: Error: some packages failed to install:
hstats-0.3 failed during the building phase. The exception was:
ExitFailure 1

How can I fix this?


Solution

  • hstats depends on base >= 2.0 and haskell98. The current version of base contains the Prelude module, which was part of haskell98 at the time base was still in version 2.x, but Prelude is now part of the base package.

    You need to unpack hstats and fix the error by yourself. Basically, exchange

    build-depends:       base>=2.0, haskell98
    

    with

    build-depends:       base>=4.0
    

    in hstats.cabal:

    $ cabal unpack hstats
    $ cd hstats-0.3
    $ vim hstats.cabal
    $ cabal install .