Ambiguous module name in multiple packages message not clear
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Describe the bug**
I was trying to see if #12126 fixes #11796 but hit another problem. Trying to run `cabal doctest` in `cabal-install` or `make doctest-install && make doctest` with `ghc-9.14.1`, I'm seeing this error:
```
Ambiguous module name ‘Network.URI’.
it was found in multiple packages:
network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2
```
**To Reproduce**
```
$ make doctest-install
$ cd cabal-install
$ ~/.ghcup/bin/cabal doctest
...
$ cabal doctest
...
doctest version 0.25.0
using version 9.14.1 of the GHC API
using /home/.../.ghcup/ghc/9.14.1/bin/ghc-9.14.1
Warning: this is a debug build of cabal-install with assertions enabled.
Configuration is affected by cabal.project at
'/home/.../cabal'.
Resolving dependencies...
Build profile: -w ghc-9.14.1 -O1
In order, the following will be built (use -v for more details):
- cabal-install-3.17.0.0 (interactive) (lib) (first run)
Preprocessing library for cabal-install-3.17.0.0...
/home/.../cabal/cabal-install/src/Distribution/Client/Types/Repo.hs:234: failure in expression `import Network.URI'
expected:
but got: : error: [GHC-45102]
^
Ambiguous module name ‘Network.URI’.
it was found in multiple packages:
network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2 network-uri-2.6.4.2
Examples: 56 Tried: 50 Errors: 0 Failures: 1
```
**Expected behavior**
That the error message would better describe the problem. These packages look to be all the same but on my system they're not.
```
$ find ~/.local/state/cabal/store/ghc-9.14.1-c6c3 -type d -name 'network-uri*' -printf '%f\n'
network-uri-2.6.4.2-cb2caf33a3c2c11211e63e0182655d8f4a7ea3da0265764e46e22e2e9177b22c
network-uri-2.6.4.2-2358c204505d73dc0be52f50d32b3b906a17195e8fdfaf8f194bea7223ed856c
network-uri-2.6.4.2-1189fd4b94c6a95e2f00ab104d79a33b5c7b8b7ad2732c3cabfb1da6b3beee23
network-uri-2.6.4.2-7a8591a999243fd975ca52114b9675de7d6f2270e130208b4a60815e5514f9f6
network-uri-2.6.4.2-7f4c247dbadf2d4d64283c386b93f293cd869c4af80b03151433712116a730e9
network-uri-2.6.4.2-665f380332cd742974edab0d78bfb4501b690422e919302722fe646cb8e750e8
network-uri-2.6.4.2-ca6b154d7eca4c224732eddcfc069e2b81b0921e1a0a3602c26852c61a960556
network-uri-2.6.4.2-6e1500520032b15e2d1f080007e199cad6528bdfd9020e5df11156134cc01fa5
network-uri-2.6.4.2-730ff294181782f8528e38d355b9140e0db515d5002a729be4efc75a97619530
network-uri-2.6.4.2-95d27f815410e1cc77eedc72c9c7cf42a9268a687166e2616a0387e61acc253a
network-uri-2.6.4.2-74e7bb592eedc12123ded00ddcdc63760a7ba7fea3e5752d572d9e41a93d4616
network-uri-2.6.4.2-94462c7c08ecf5330ecf45950429ecd3840f812edcb023a9d5a7f4b4cbc0f3f5
```
**System information**
```
$ ~/.ghcup/bin/cabal --numeric-version
3.16.1.0
$ ghc --numeric-version
9.14.1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 26.04 LTS
Release: 26.04
Codename: resolute
```
Contributor guide
Research direction
Reproduce the failure with `make doctest-install` followed by `cabal doctest` on GHC 9.14.1, using the expression at `cabal-install/src/Distribution/Client/Types/Repo.hs:234` as the entry point. Trace how the ambiguous `Network.URI` diagnostic is produced and make the reported package instances distinguishable, then rerun the doctest command to confirm the message explains why the packages differ.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100