14

I get this when i want to recompile xmonad to change the configuration:

Implicit import declaration:
    Ambiguous module name `Prelude':
      it was found in multiple packages: base haskell98-2.0.0.0

Xmonad was installed via pacman. When i got this error i removed xmonad from pacman and then tried to cabal install xmonad. I got the above error again but i was able to solve it by removing haskell98 from the cabal file.

Now i want to reconfigure xmonad with MOD-Q the error reappears and i have no clue how to fix this. Any help appreciated.

I use GHC version 7.0.3 (from Haskell platform)

somesoaccount
  • 1,267
  • 15
  • 37

3 Answers3

15

Try this:

ghc-pkg hide haskell98
sclv
  • 38,665
  • 7
  • 99
  • 204
  • Yeah, i just managed to get it work with following commands: `cd ~/.xmonad ghc xmonad.hs -hide-package haskell98 mv xmonad-x86_64-linux xmonad-x86_64-linux.good mv xmonad xmonad-x86_64-linux` Then i restarted my computer (restarting X would probably enough). Now i need to automate this somehow. Also i need to learn how to format comments. – somesoaccount Sep 07 '11 at 20:18
  • I just noticed you mentioned ghc-pkg. I tried that earlier and it didn't work. – somesoaccount Sep 07 '11 at 20:28
  • Ok, i'm confused. I _thought_ i tried your suggestion before, but apparently i didn't. Your solution works like a charm! – somesoaccount Sep 07 '11 at 20:31
  • "openBinaryTempFile: permission denied" *hates Win7 UAC* – John Dvorak Dec 06 '14 at 13:16
2

In my case hiding haskell98 unfortunately was insufficient, I had to remove the obsolete haskell98 from the build-depends list in my .cabal build file (keeping the base >= 4 of course). It read before:

build-depends:  
    base >= 4,
    haskell98

... and then ...

build-depends:  
    base >= 4

With that the error message "Ambiguous module name `Prelude'" above disappeared.

Hartmut Pfarr
  • 5,534
  • 5
  • 36
  • 42
1

See this GHC bug ticket on the same subject:

GHC starting with version 7.2.1 will not support using the haskell98 package and the base package at the same time. The haskell-src package has both of these in its build-depends, so it will need to be modified. Most of the time, what you want to do is remove haskell98 from build-depends, and fix up any imports of Haskell 98 modules to point to their base equivalents.

The bug ticket was closed (without a fix), and the original filer responded:

Yes, removing haskell98 from .cabal file seems to have fixed it - it did compile without errors. It looks like it didn't have any imports to haskell98, because according to comment in .cabal file.

reuben
  • 3,360
  • 23
  • 28
Gabriel Riba
  • 6,698
  • 2
  • 17
  • 19