Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell: same module found twice - "Ambiguous module name"

Tags:

haskell

cabal

I have the following import in a haskell file. I'm using cabal.

import Network.Wai (Application, Response, rawPathInfo, responseFile, responseLBS, requestBody)

But I'm getting this error when I try to build the file:

Error: Ambiguous module name ‘Network.Wai’:
  it was found in multiple packages: wai-3.2.2.1 wai-3.2.2.1

Note that the multiple packages are exactly the same. Something like -XPackageImports doesn't work here, because for some reason the same package is installed twice.

I opened up /Users/<user>/.cabal/store/ghc-8.6.5/package.db and sure enough, there were two "w" (wai) packages with the same version but different hashes. I deleted one and this didn't fix it.

like image 692
Erty Seidohl Avatar asked Dec 01 '25 23:12

Erty Seidohl


1 Answers

In my case, it was the Data.IP that was ambiguous and it showed 2 same versions of iproute.

I read in https://cabal.readthedocs.io/en/3.4/nix-local-build.html that you can safely delete the store folder. So I ran the below commands.

rm -rf ~/.cabal/store
cabal build

Then my problem went away. This might be useful to anyone else struggling with this issue.

like image 120
Vlam Avatar answered Dec 04 '25 18:12

Vlam



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!